Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Defines an object that's used to observe and manage a thread of execution within an application.
class thread;
Remarks
You can use a thread object to observe and manage a thread of execution within an application. A thread object that's created by using the default constructor is not associated with any thread of execution. A thread object that's constructed by using a callable object creates a new thread of execution and calls the callable object in that thread. Thread objects can be moved but not copied. Therefore, a thread of execution can be associated with only one thread object.
Every thread of execution has a unique identifier of type thread::id. The function this_thread::get_id returns the identifier of the calling thread. The member function thread::get_id returns the identifier of the thread that's managed by a thread object. For a default-constructed thread object, the thread::get_id method returns an object that has a value that's the same for all default-constructed thread objects and different from the value that's returned by this_thread::get_id for any thread of execution that could be joined at the time of the call.
Members
Public Classes
Name |
Description |
---|---|
Uniquely identifies the associated thread. |
Public Constructors
Name |
Description |
---|---|
Constructs a thread object. |
Public Methods
Name |
Description |
---|---|
Detaches the associated thread from the thread object. |
|
Returns the unique identifier of the associated thread. |
|
Static. Returns an estimate of the number of hardware thread contexts. |
|
Blocks until the associated thread completes. |
|
Specifies whether the associated thread is joinable. |
|
Returns the implementation-specific type that represents the thread handle. |
|
Swaps the object state with a specified thread object. |
Public Operators
Name |
Description |
---|---|
Associates a thread with the current thread object. |
Requirements
Header: thread
Namespace: std