Member | Description |
---|---|
thread() |
Constructs a thread that does not represent a thread of execution, with get_id()==id(). |
template<typename F> thread(F f) |
Construct a thread that evaluates f() |
template<typename F, typename X> thread(F f, X x) |
Constructs a thread that evaluates f(x). |
template<typename F, typename X, typename Y> thread(F f, X x, Y y) |
Constructs thread that evaluates f(x,y). |
thread& operator=(thread& x) |
If joinable(), calls detach(). Then assigns the state of x to *this and sets x to default constructed state. CautionAssignment moves the state instead of copying it. |
~thread |
if( joinable() ) detach(). |
bool joinable() const |
Returns: get_id()!=id() |
void join() |
Requirements: joinable()==true Effects: Wait for thread to complete. Afterwards, joinable()==false. |
void detach() |
Requirements: joinable()==true Effects: Sets *this to default constructed state and returns without blocking. The thread represented by *this continues execution. |
id get_id() const |
Returns: id of the thread, or a default-constructed id if *this does not represent a thread. |
native_handle_type native_handle() |
Returns: Native thread handle. The handle is a HANDLE on Windows* operating systems and a pthread_t on Linux* and OS* X operating systems. For these systems, native_handle() returns 0 if joinable()==false. |
static unsigned hardware_concurrency() |
Returns: The number of hardware threads. For example, 4 on a system with a single Intel® Core™2 Quad processor. |