Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Attempts to obtain ownership of the mutex without blocking.
template<class Clock, class Duration>
bool try_lock_for(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 or if the calling thread already owns the mutex; otherwise, false.
Remarks
If the calling thread already owns the mutex, the method immediately returns true, and the previous lock remains in effect.
Requirements
Header: mutex
Namespace: std