public member function
<mutex>

std::recursive_timed_mutex::try_lock

bool try_lock() noexcept;
Lock recursive timed mutex if not locked
Attempts to lock the recursive_timed_mutex, without blocking (it behaves exactly as in recursive_mutex):


This function may fail spuriously when no other thread has a lock on the recursive_timed_mutex, but repeated calls in these circumstances shall succeed at some point.

All lock and unlock operations on the recursive_timed_mutex follow a single total order, with all visible effects synchronized between the lock operations and previous unlock operations on the same object.

Parameters

none

Return value

true if the function succeeds in locking the recursive_timed_mutex for the thread.
false otherwise.

Data races

The recursive_timed_mutex object is accessed/modified as an atomic operation (causes no data races).

Exception safety

No-throw guarantee: never throws exceptions.

See also