Documentation Home

Construct a std::shared_lock instance associated with the supplied mutex and tries to acquire a shared-ownership lock on that mutex.

shared_lock(mutex_type& m,std::try_to_lock_t);

Effects:

Constructs a std::shared_lock instance that references the supplied mutex. Calls m.try_lock_shared().

Throws:

Nothing.

Postcondition:

this->owns_lock() returns the result of the m.try_lock_shared() call, this->mutex()==&m.

Header

#include <shared_mutex>

See Also