Delen via


unique_lock::try_lock_until Method

Attempts to obtain ownership of the associated mutex without blocking.

template<class Clock, class Duration>
   bool try_lock_until(const chrono::time_point<Clock, Duration>& Abs_time);
bool try_lock_until(const xtime *Abs_time);

Parameters

  • Abs_time
    A point in time that specifies the threshold after which the method no longer attempts to obtain ownership of the mutex.

Return Value

true if the method successfully obtains ownership of the mutex; otherwise, false.

Remarks

If the stored mutex pointer is null, the method throws a system_error that has an error code of operation_not_permitted.

If the calling thread already owns the mutex, the method throws a system_error that has an error code of resource_deadlock_would_occur.

Requirements

Header: mutex

Namespace: std

See Also

Reference

unique_lock Class

<mutex>

time_point Class