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

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

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

Precondition:

The calling thread must own a lock on m.

Effects:

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

Throws:

Nothing.

Postcondition:

*this owns the lock on m held by the calling thread.

Header

#include <mutex>

See Also