std::timed_mutex::try_lock_for

From Cppreference

Jump to: navigation, search
template< typename Clock, typename Duration >
void try_lock_until( const std::chrono::time_point<Clock,Duration>& timeout_time );
(C++11 feature)

Tries to lock the mutex. Blocks until specified timeout_time has been reached or the lock is acquired, whichever comes first. On successful lock acquisition returns true, otherwise returns false. May block for longer than until timeout_time has been reached.

Contents

[edit] Parameters

(none)

[edit] Return value

true if the lock was acquired successfully, otherwise false.

[edit] Exceptions

[edit] Example

[edit] See also

lock
locks the mutex, blocks if the mutex is not available
(public member function)
try_lock
tries to lock the mutex, returns if the mutex is not available
(public member function)
try_lock_for
tries to lock the mutex, returns if the mutex is not
available for the specified timeout duration
(public member function)
unlock
unlocks the mutex
(public member function)