◐ Shell
clean mode source ↗

std::thread::get_id - cppreference.com

Da cppreference.com.

Questa pagina è stata tradotta in modo automatico dalla versione in ineglese della wiki usando Google Translate.

La traduzione potrebbe contenere errori e termini strani. Muovi il puntatore sopra al testo per vedere la versione originale. Puoi aiutarci a correggere gli gli errori. Per ulteriori istruzioni clicca qui.

Click here for the English version of this page

<metanoindex/>

<tbody> </tbody>

std::thread::id get_id() const;

(dal C++11)

Restituisce un valore di std::thread::id identificare il thread associato *this.

Original:

Returns a value of std::thread::id identifying the thread associated with *this.

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Parametri

(Nessuno)

Original:

(none)

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Valore di ritorno

un valore di tipo std::thread::id identificare il thread associato *this. Se non ci sono thread associato, std::thread::id predefinito costruito viene restituito.

Original:

a value of type std::thread::id identifying the thread associated with *this. If there is no thread associated, default constructed std::thread::id is returned.

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Eccezioni

Esempio

#include <iostream>
#include <thread>
#include <chrono>

void foo()
{
    std::this_thread::sleep_for(std::chrono::seconds(1));
}

int main()
{
    std::thread t1(foo);
    std::thread::id t1_id = t1.get_id();

    std::thread t2(foo);
    std::thread::id t2_id = t2.get_id();

    std::cout << "t1's id: " << t1_id << '\n';
    std::cout << "t2's id: " << t2_id << '\n';

    t1.join();
    t2.join();
}

Possible output:

t1's id: 0x35a7210f
t2's id: 0x35a311c4

Vedi anche

rappresenta la' id di un filo

Original:

represents the id of a thread

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(membro pubblico classe) [modifica]

verifica se il filo è unibili, cioè potenzialmente in esecuzione nel contesto parallelo

Original:

checks whether the thread is joinable, i.e. potentially running in parallel context

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(metodo pubblico) [modifica]