Documentation Home >> Headers >> <mutex> Header >> std::unique_lock >> std::unique_lock Try-to-lock Constructor with a time_point timeout

Construct a std::unique_lock instance associated with the supplied mutex and tries to acquire a lock on that mutex.

template<typename Clock,typename Duration>
unique_lock(
    mutex_type& m,
    std::chrono::time_point<Clock,Duration> const&
    absolute_time);

Preconditions:

The Mutex type used to instantiate std::unique_lock must meet the TimedLockable requirements.

Effects:

Constructs a std::unique_lock instance that references the supplied mutex. Calls m.try_lock_until(absolute_time).

Throws:

Nothing.

Postcondition:

this->owns_lock() returns the result of the m.try_lock_until() call, this->mutex()==&m.

Header

#include <mutex>

See Also