Documentation Home

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

template<typename Clock,typename Duration>
shared_lock(
    mutex_type& m,
    std::chrono::time_point<Clock,Duration> const&
    absolute_time);

Preconditions:

The Mutex type used to instantiate std::shared_lock must meet the TimedLockable requirements.

Effects:

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

Throws:

Nothing.

Postcondition:

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

Header

#include <shared_mutex>

See Also