namespace std { class shared_mutex { public: shared_mutex(); ~shared_mutex(); shared_mutex(const shared_mutex&) = delete; shared_mutex& operator=(const shared_mutex&) = delete; // Exclusive ownership void lock(); // blocking bool try_lock(); void unlock(); // Shared ownership void lock_shared(); // blocking bool try_lock_shared(); void unlock_shared(); using native_handle_type = implementation-defined; // See [thread.req.native] native_handle_type native_handle(); // See [thread.req.native] }; }
The class shared_mutex shall satisfy all of the shared mutex requirements. It shall be a standard-layout class (Clause [class]).
The behavior of a program is undefined if:
it destroys a shared_mutex object owned by any thread,
a thread attempts to recursively gain any ownership of a shared_mutex, or
a thread terminates while possessing any ownership of a shared_mutex.