From Cppreference
|
|
|
|
|
template<typename Mutex> class unique_lock;
|
|
(C++11 feature)
|
|
|
The class unique_lock implements general-purpose mutex ownership wrapper allowing deferred locking, timed locking, recursive locking, transfer of lock ownership, and use with condition variables. The class is non-copyable but movable.
[edit] Member types
|
Member type
|
Definition
|
|
mutex_type
|
Mutex
|
[edit] Member functions
|
|
Constructs a unique_lock, optionally locking the supplied mutex (public member function)
|
|
|
Unlocks the supplied mutex, if owned (public member function)
|
|
|
Unlocks the mutex, if owned, and acquires ownership of another (public member function)
|
|
|
Locks the supplied mutex (public member function)
|
|
|
Attempts to lock the supplied mutex (public member function)
|
|
|
Attempts to lock the supplied TimedLockable mutex for specified std::duration (public member function)
|
|
|
Attempts to lock the supplied TimedLockable mutex until specified std::time_point (public member function)
|
|
|
Unlocks the supplied mutex (public member function)
|
|
|
Swaps state with another std::unique_lock (public member function)
|
|
|
Returns a pointer to the supplied mutex (public member function)
|
|
|
Unlocks the mutex and returns a pointer to the mutex object (public member function)
|
|
|
Tests if this unique_lock owns its mutex (public member function)
|
|
|
Tests if this unique_lock owns its mutex (public member function)
|
[edit] Helper classes
|
|
tag type used to disambiguate unique_lock constructors (class)
|
|
|
tag type used to disambiguate unique_lock constructors (class)
|
|
|
tag type used to disambiguate unique_lock constructors (class)
|
[edit] Non-member constants
|
|
tag constant used to disambiguate unique_lock constructors (constant)
|
|
|
tag constant used to disambiguate unique_lock constructors (constant)
|
|
|
tag constant used to disambiguate unique_lock constructors (constant)
|
[edit] Non-member functions
|
|
Specialization of std::swap for unique_locks (function template)
|
[edit] Example