Files
2025-10-25 03:02:53 +03:00

2.3 KiB

[thread.sharedmutex.class]

32 Concurrency support library [thread]

32.6 Mutual exclusion [thread.mutex]

32.6.4 Mutex requirements [thread.mutex.requirements]

32.6.4.4 Shared mutex types [thread.sharedmutex.requirements]

32.6.4.4.2 Class shared_mutex [thread.sharedmutex.class]

🔗

namespace std {class shared_mutex {public: shared_mutex(); ~shared_mutex();

shared_mutex(const shared_mutex&) = delete; shared_mutex& operator=(const shared_mutex&) = delete; // exclusive ownershipvoid lock(); // blockingbool try_lock(); void unlock(); // shared ownershipvoid lock_shared(); // blockingbool 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]};}

1

#

The class shared_mutex provides a non-recursive mutex with shared ownership semantics.

2

#

The class shared_mutex meets all of the shared mutex requirements ([thread.sharedmutex.requirements]).

It is a standard-layout class ([class.prop]).

3

#

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.

4

#

shared_mutex may be a synonym for shared_timed_mutex.