std::thread::joinable – cppreference.com
Aus cppreference.com
<metanoindex/>
<tbody> </tbody>
|
|
(seit C++11) | |
Prüft, ob der Thread-Objekt identifiziert einen aktiven Thread der Ausführung. Insbesondere kehrt true wenn 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.
Parameter
(None)
Original:
(none)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Rückgabewert
true wenn das Thread-Objekt eine aktive Thread der Ausführung identifiziert, false anders
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.
Ausnahmen
Beispiel
#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
Siehe auch
| liefert die ID des Threads (öffentliche Elementfunktion) [edit] | |
| warten, bis ein Thread seine Ausführung beendet (öffentliche Elementfunktion) [edit] | |
| Thread lösen, so dass er unabhängig vom Thread Handle ausgeführt werden kann (öffentliche Elementfunktion) [edit] | |