Documentation Home >> Headers >> <mutex> Header >> std::lock_guard >> std::lock_guard Locking Constructor

Construct a std::lock_guard instance that locks the supplied mutex.

explicit lock_guard(mutex_type& m);

Effects:

Constructs a std::lock_guard instance that references the supplied mutex. Calls m.lock().

Throws:

Any exceptions thrown by m.lock().

Postcondition:

*this owns a lock on m.

Header

#include <mutex>

See Also