32 Thread support library [thread]

32.5 Mutual exclusion [thread.mutex]

32.5.4 Locks [thread.lock]

32.5.4.4 Class template shared_­lock [thread.lock.shared]

32.5.4.4.1 Constructors, destructor, and assignment [thread.lock.shared.cons]

shared_lock() noexcept;
Postconditions: pm == nullptr and owns == false.
explicit shared_lock(mutex_type& m);
Preconditions: The calling thread does not own the mutex for any ownership mode.
Effects: Calls m.lock_­shared().
Postconditions: pm == addressof(m) and owns == true.
shared_lock(mutex_type& m, defer_lock_t) noexcept;
Postconditions: pm == addressof(m) and owns == false.
shared_lock(mutex_type& m, try_to_lock_t);
Preconditions: The calling thread does not own the mutex for any ownership mode.
Effects: Calls m.try_­lock_­shared().
Postconditions: pm == addressof(m) and owns == res where res is the value returned by the call to m.try_­lock_­shared().
shared_lock(mutex_type& m, adopt_lock_t);
Preconditions: The calling thread has shared ownership of the mutex.
Postconditions: pm == addressof(m) and owns == true.
template<class Clock, class Duration> shared_lock(mutex_type& m, const chrono::time_point<Clock, Duration>& abs_time);
Preconditions: The calling thread does not own the mutex for any ownership mode.
Effects: Calls m.try_­lock_­shared_­until(abs_­time).
Postconditions: pm == addressof(m) and owns == res where res is the value returned by the call to m.try_­lock_­shared_­until(abs_­time).
template<class Rep, class Period> shared_lock(mutex_type& m, const chrono::duration<Rep, Period>& rel_time);
Preconditions: The calling thread does not own the mutex for any ownership mode.
Effects: Calls m.try_­lock_­shared_­for(rel_­time).
Postconditions: pm == addressof(m) and owns == res where res is the value returned by the call to m.try_­lock_­shared_­for(rel_­time).
~shared_lock();
Effects: If owns calls pm->unlock_­shared().
shared_lock(shared_lock&& sl) noexcept;
Postconditions: pm == sl_­p.pm and owns == sl_­p.owns (where sl_­p is the state of sl just prior to this construction), sl.pm == nullptr and sl.owns == false.
shared_lock& operator=(shared_lock&& sl) noexcept;
Effects: If owns calls pm->unlock_­shared().
Postconditions: pm == sl_­p.pm and owns == sl_­p.owns (where sl_­p is the state of sl just prior to this assignment), sl.pm == nullptr and sl.owns == false.