std::unique_lock<Mutex>::try_lock_for
Min standard notice:
Tries to lock (i.e., takes ownership of) the associated mutex. Blocks until specified timeout_duration has elapsed or the lock is acquired, whichever comes first. On successful lock acquisition returns true, otherwise returns false. Effectively calls mutex()->try_lock_for(timeout_duration).
# Declarations
template< class Rep, class Period >
bool try_lock_for( const std::chrono::duration<Rep, Period>& timeout_duration );
(since C++11)
# Parameters
timeout_duration: maximum duration to block for
# Return value
true if the ownership of the mutex has been acquired successfully, false otherwise.
# Example
This section is incompleteReason: no example