public member function
<mutex>

std::unique_lock::try_lock_until

template <class Clock, class Duration>  bool try_lock_until (const chrono::time_point<Clock,Duration>& abs_time);
Try to lock mutex until time point
Calls member try_lock_until of the managed timed mutex object, and uses the returned value to set the owning state.

If the owning state is already true before the call, or if the object currently manages no mutex object, the function throws a system_error exception.

Parameters

abs_time
A point in time at which the thread will stop blocking, renouncing to acquire a lock.
time_point is an object that represents a specific absolute time.

Return value

true if the function succeeds in locking the managed timed mutex object.
false otherwise.

Data races

The unique_lock object is accessed/modified.
The managed timed mutex object is accessed/modified as an atomic operation (causing no data races).

Exception safety

Basic guarantee: if an exception is thrown by this member function, the unique_lock object is left in a valid state.

If the call fails, a system_error exception is thrown:
exception typeerror conditiondescription
system_errorerrc::resource_deadlock_would_occurThe unique_lock object already owns a lock
system_errorerrc::operation_not_permittedThe unique_lock object currently manages no mutex object (because it was default-constructed, moved, or released)
An exception is also thrown if the call to try_lock_until on the managed timed mutex object fails, and on any other condition reported with such mechanism by the library implementation.

See also