std::thread::joinable
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. |
<metanoindex/>
<tbody> </tbody> bool joinable(); |
(dal C++11) | |
Verifica se l'oggetto thread identifica un thread attivo di esecuzione. In particolare, se restituisce
true get_id() != std::thread::id().Original:
Checks if the thread object identifies an active thread of execution. Specifically, returns
true if get_id() != std::thread::id().The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
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.
You can help to correct and verify the translation. Click here for instructions.
Valore di ritorno
true se l'oggetto thread identifica un thread attivo di esecuzione, false altrimentiOriginal:
true if the thread object identifies an active thread of execution, false otherwiseThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
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 t;
std::cout << "before starting, joinable: " << t.joinable() << '\n';
t = std::thread(foo);
std::cout << "after starting, joinable: " << t.joinable() << '\n';
t.join();
}
Output:
before starting, joinable: 0
after starting, joinable: 1
Vedi anche
restituisce l'id' del filo Original: returns the id of the thread The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (metodo pubblico) | |
attesa di un thread per terminare la sua esecuzione Original: waits for a thread to finish its execution The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (metodo pubblico) | |
consente il filo di eseguire indipendentemente dalla impugnatura filo Original: permits the thread to execute independently from the thread handle The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (metodo pubblico) | |