Acquires a lock on a std::mutex object for the current
thread.
void lock();
- Preconditions:
The calling thread must not hold a lock on
*this.- Effects:
Blocks the current thread until a lock on
*thiscan be obtained.- Postconditions:
*thisis locked by the calling thread.- Throws:
An exception of type
std::system_errorif an error occurs.
Header
#include <mutex>