From cppreference.com
This header is part of the
library.
Classes
(C++17)
provides shared mutual exclusion facility
(class)
(C++14)
provides shared mutual exclusion facility and implements locking with a timeout
(class)
(C++14)
implements movable shared mutex ownership wrapper
(class template)
Functions
(C++14)
specializes the
algorithm
(function template)
Synopsis
namespacestd{classshared_mutex;classshared_timed_mutex;template<classMutex>classshared_lock;template<classMutex>voidswap(shared_lock<Mutex>&x,shared_lock<Mutex>&y)noexcept;}Class
namespacestd{classshared_mutex{public:shared_mutex();~shared_mutex();shared_mutex(constshared_mutex&)=delete;shared_mutex&operator=(constshared_mutex&)=delete;// exclusive ownershipvoidlock();// blockingbooltry_lock();voidunlock();// shared ownershipvoidlock_shared();// blockingbooltry_lock_shared();voidunlock_shared();usingnative_handle_type=/* implementation-defined */;native_handle_typenative_handle();};}Class
namespacestd{classshared_timed_mutex{public:shared_timed_mutex();~shared_timed_mutex();shared_timed_mutex(constshared_timed_mutex&)=delete;shared_timed_mutex&operator=(constshared_timed_mutex&)=delete;// exclusive ownershipvoidlock();// blockingbooltry_lock();template<classRep,classPeriod>booltry_lock_for(constchrono::duration<Rep,Period>&rel_time);template<classClock,classDuration>booltry_lock_until(constchrono::time_point<Clock,Duration>&abs_time);voidunlock();// shared ownershipvoidlock_shared();// blockingbooltry_lock_shared();template<classRep,classPeriod>booltry_lock_shared_for(constchrono::duration<Rep,Period>&rel_time);template<classClock,classDuration>booltry_lock_shared_until(constchrono::time_point<Clock,Duration>&abs_time);voidunlock_shared();};}Class template
namespacestd{template<classMutex>classshared_lock{public:usingmutex_type=Mutex;// construct/copy/destroyshared_lock()noexcept;explicitshared_lock(mutex_type&m);// blockingshared_lock(mutex_type&m,defer_lock_t)noexcept;shared_lock(mutex_type&m,try_to_lock_t);shared_lock(mutex_type&m,adopt_lock_t);template<classClock,classDuration>shared_lock(mutex_type&m,constchrono::time_point<Clock,Duration>&abs_time);template<classRep,classPeriod>shared_lock(mutex_type&m,constchrono::duration<Rep,Period>&rel_time);~shared_lock();shared_lock(constshared_lock&)=delete;shared_lock&operator=(constshared_lock&)=delete;shared_lock(shared_lock&&u)noexcept;shared_lock&operator=(shared_lock&&u)noexcept;// lockingvoidlock();// blockingbooltry_lock();template<classRep,classPeriod>booltry_lock_for(constchrono::duration<Rep,Period>&rel_time);template<classClock,classDuration>booltry_lock_until(constchrono::time_point<Clock,Duration>&abs_time);voidunlock();// modifiersvoidswap(shared_lock&u)noexcept;mutex_type*release()noexcept;// observersboolowns_lock()constnoexcept;explicitoperatorbool()constnoexcept;mutex_type*mutex()constnoexcept;private:mutex_type*pm;// exposition onlyboolowns;// exposition only};template<classMutex>voidswap(shared_lock<Mutex>&x,shared_lock<Mutex>&y)noexcept;}