Namespaces
Variants
Views
Actions

std::unique_lock

From cppreference.com
Defined in header <mutex>
template< class Mutex >
class unique_lock;
(since C++11)

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.

Contents

[edit] Member types

Type Definition
mutex_type Mutex

[edit] Member functions

constructs a lock, optionally locking the supplied mutex
(public member function) [edit]
unlocks the associated mutex, if owned
(public member function) [edit]
unlocks the mutex, if owned, and acquires ownership of another
(public member function) [edit]
Locking
locks the associated mutex
(public member function) [edit]
tries to lock the associated mutex, returns if the mutex is not available
(public member function) [edit]
attempts to lock the associated TimedLockable mutex, returns if the
mutex has been unavailable for the specified time duration
(public member function) [edit]
tries to lock the associated TimedLockable mutex, returns if the
mutex has been unavailable until specified time point has been reached
(public member function) [edit]
unlocks the associated mutex
(public member function) [edit]
Modifiers
swaps state with another std::unique_lock
(public member function) [edit]
disassociates the associated mutex without unlocking it
(public member function) [edit]
Observers
returns a pointer to the associated mutex
(public member function) [edit]
tests whether the lock owns its associated mutex
(public member function) [edit]
tests whether the lock owns its associated mutex
(public member function) [edit]

[edit] Non-member functions

specialization of std::swap for unique_lock
(function template) [edit]