Construct a std::unique_lock instance associated
with the supplied mutex and tries to acquire a lock on that mutex.
template<typename Rep,typename Period> unique_lock(mutex_type& m,std::chrono::duration<Rep,Period> const& relative_time);
- Preconditions:
The
Mutextype used to instantiatestd::unique_lockmust meet theTimedLockablerequirements.- Effects:
Constructs a
std::unique_lockinstance that references the supplied mutex. Callsm.try_lock_for(relative_time).- Throws:
Nothing.
- Postcondition:
this->owns_lock()returns the result of them.try_lock_for()call,this->mutex()==&m.
Header
#include <mutex>