unique_lock Class
Represents a template that can be instantiated to create objects that manage the locking and unlocking of a mutex.
template<class Mutex>
class unique_lock;
Remarks
The template argument Mutex must name a mutex type.
Internally, a unique_lock stores a pointer to an associated mutex object and a bool that indicates whether the current thread owns the mutex.
Members
Public Typedefs
Name |
Description |
---|---|
unique_lock::mutex_type |
Synonym for the template argument Mutex. |
Public Constructors
Name |
Description |
---|---|
Constructs a unique_lock object. |
|
Releases any resources that are associated with the unique_lock object. |
Public Methods
Name |
Description |
---|---|
Blocks the calling thread until the thread obtains ownership of the associated mutex. |
|
Retrieves the stored pointer to the associated mutex. |
|
Specifies whether the calling thread owns the associated mutex. |
|
Disassociates the unique_lock object from the associated mutex object. |
|
Swaps the associated mutex and ownership status with that of a specified object. |
|
Attempts to obtain ownership of the associated mutex without blocking. |
|
Attempts to obtain ownership of the associated mutex without blocking. |
|
Attempts to obtain ownership of the associated mutex without blocking. |
|
Releases ownership of the associated mutex. |
Public Operators
Name |
Description |
---|---|
Specifies whether the calling thread has ownership of the associated mutex. |
|
Copies the stored mutex pointer and associated ownership status from a specified object. |
Inheritance Hierarchy
unique_lock
Requirements
Header: mutex
Namespace: std