Acquires a lock on the mutex associated with *this.
void lock();
- Preconditions:
this->mutex()!=NULL,this->owns_lock()==false.- Effects:
Calls
this->mutex()->lock().- Throws:
Any exceptions thrown by
this->mutex()->lock().std::system_errorwith an error code ofstd::errc::operation_not_permittedifthis->mutex()==NULL.std::system_errorwith an error code ofstd::errc::resource_deadlock_would_occurifthis->owns_lock()==trueon entry.- Postcondition:
this->owns_lock()==true.
Header
#include <mutex>