|
libstdc++
|
#include <thread>
Classes | |
| class | id |
Public Types | |
| using | _State_ptr = unique_ptr< _State > |
| using | native_handle_type = __gthread_t |
Public Member Functions | |
| template<typename _Callable , typename... _Args, typename = _Require<__not_same<_Callable>>> | |
| thread (_Callable &&__f, _Args &&... __args) | |
| thread (const thread &)=delete | |
| thread (thread &&__t) noexcept | |
| void | detach () |
| id | get_id () const noexcept |
| void | join () |
| bool | joinable () const noexcept |
| native_handle_type | native_handle () |
| thread & | operator= (const thread &)=delete |
| thread & | operator= (thread &&__t) noexcept |
| void | swap (thread &__t) noexcept |
Static Public Member Functions | |
| static unsigned int | hardware_concurrency () noexcept |
Related Symbols | |
(Note that these are not member symbols.) | |
| void | swap (thread &__x, thread &__y) noexcept |
A std::thread represents a new thread of execution.
The default constructor creates an object that does not own a thread. The thread(F&&, Args&&...) constructor invokes a callable in a new thread, and owns that new thread. A std::thread that owns a thread is joinable. Joining a thread waits for it to finish executing, which happens when the callable running in that thread returns.
A std::thread cannot be copied, but can be moved. Moving a joinable object transfers ownership of its thread to another object.
A joinable std::thread must be explicitly joined (or detached) before it is destroyed or assigned to. Attempting to destroy a joinable thread will terminate the whole process.
Definition at line 78 of file std_thread.h.
| using std::thread::_State_ptr = unique_ptr<_State> |
Definition at line 89 of file std_thread.h.
| using std::thread::native_handle_type = __gthread_t |
Definition at line 91 of file std_thread.h.
|
inlineexplicit |
Definition at line 147 of file std_thread.h.
|
inline |
Definition at line 169 of file std_thread.h.
|
inlinenoexcept |
Definition at line 177 of file std_thread.h.
|
inlinenoexcept |
Definition at line 205 of file std_thread.h.
|
inlinenoexcept |
Definition at line 195 of file std_thread.h.
|
inline |
Definition at line 211 of file std_thread.h.
Definition at line 182 of file std_thread.h.
|
inlinenoexcept |
Definition at line 191 of file std_thread.h.