33 Thread support library [thread]

33.4 Mutual exclusion [thread.mutex]

33.4.3 Mutex requirements [thread.mutex.requirements] Shared mutex types [thread.sharedmutex.requirements] Class shared_mutex [thread.sharedmutex.class]

namespace std {
  class 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 provides a non-recursive mutex with shared ownership semantics.

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:

shared_­mutex may be a synonym for shared_­timed_­mutex.