std::thread::joinable - cppreference.com
De cppreference.com
<metanoindex/>
<tbody> </tbody>
|
|
(desde C++11) | |
Verifica se o objeto de discussão identifica um segmento ativo da execução. Especificamente, os retornos true se 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.
Parâmetros
(Nenhum)
Original:
(none)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Valor de retorno
true se o objeto de discussão identifica um segmento ativo da execução, false contrário
Original:
true if the thread object identifies an active thread of execution, false otherwise
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Exceções
Exemplo
#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(); }
Saída:
before starting, joinable: 0 after starting, joinable: 1
Veja também
| retorna o ID do thread (função pública membro) [edit] | |
| espera que um objeto thread termine sua execução antes de sair da função (função pública membro) [edit] | |
permite a thread para executar de forma independente do identificador segmento Original: permits the thread to execute independently from the thread handle The text has been machine-translated via Google Translate. (função pública membro) [edit] | |