The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

recursive_timed_mutex::try_lock_for Method

Attempts to obtain ownership of the mutex without blocking.

template<class Rep, class Period>
   bool try_lock_for(const chrono::duration<Rep, Period>& Rel_time);


A chrono::duration object that specifies the maximum amount of time that the method attempts to obtain ownership of the mutex.

true if the method successfully obtains ownership of the mutex or if the calling thread already owns the mutex; otherwise, false.

If the calling thread already owns the mutex, the method immediately returns true, and the previous lock remains in effect.

Header: mutex

Namespace: std

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
© 2014 Microsoft