mutex::try_lock Method (STL)

Attempts to obtain ownership of the mutex without blocking.

bool try_lock();

Return Value

true if the method successfully obtains ownership of the mutex; otherwise, false.

Remarks

If the calling thread already owns the mutex, the behavior is undefined.

Requirements

Header: mutex

Namespace: std

See Also

Reference

<mutex>

mutex Class (STL)

Other Resources

Header Files