explicit lock_guard( mutex_type& m ); | (1) | (since C++11) |
lock_guard( mutex_type& m, std::adopt_lock_t t ); | (2) | (since C++11) |
lock_guard( const lock_guard& ) = delete; | (3) | (since C++11) |
Acquires ownership of the given mutex m
.
m.lock()
. The behavior is undefined if m
is not a recursive mutex and the current thread already owns m
.m
without attempting to lock it. The behavior is undefined if the current thread does not own m
.The behavior is undefined if m
is destroyed before the lock_guard
object is.
m | - | mutex to acquire ownership of |
t | - | tag parameter used to select non-locking version of the constructor |
1) Throws any exceptions thrown by m.lock()
.
2) Throws nothing.
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
http://en.cppreference.com/w/cpp/thread/lock_guard/lock_guard