Documentation Home >> Headers >> <mutex> Header >> std::unique_lock >> std::unique_lock Lock-adopting Constructor

Construct a std::unique_lock instance that owns the lock on the supplied mutex.

unique_lock(mutex_type& m,std::adopt_lock_t);

Precondition:

The calling thread must own a lock on m.

Effects:

Constructs a std::unique_lock instance that references the supplied mutex and takes ownership of the lock on m held by the calling thread.

Throws:

Nothing.

Postcondition:

this->owns_lock()==true, this->mutex()==&m.

Header

#include <mutex>

See Also