Template:cpp/thread/mutex/try lock for

Tries to lock the mutex. Blocks until specified has elapsed or the lock is acquired, whichever comes first. On successful lock acquisition returns, otherwise returns.

If is less or equal, the function behaves like try_lock.

This function may block for longer than due to scheduling or resource contention delays.

The standard recommends that a is used to measure the duration. If an implementation uses a instead, the wait time may also be sensitive to clock adjustments.

As with try_lock, this function is allowed to fail spuriously and return even if the mutex was not locked by any other thread at some point during.

Prior unlock operation on the same mutex synchronizes-with (as defined in std) this operation if it returns.

Return value
if the lock was acquired successfully, otherwise.

Exceptions
Any exception thrown by clock, time_point, or duration during the execution (clocks, time points, and durations provided by the standard library never throw)