32 Thread support library [thread]
namespace std {
class shared_mutex {
public:
shared_mutex();
~shared_mutex();
shared_mutex(const shared_mutex&) = delete;
shared_mutex& operator=(const shared_mutex&) = delete;
void lock();
bool try_lock();
void unlock();
void lock_shared();
bool try_lock_shared();
void unlock_shared();
using native_handle_type = implementation-defined;
native_handle_type native_handle();
};
}
The class
shared_mutex provides a non-recursive mutex
with shared ownership semantics
.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.
shared_mutex may be a synonym for
shared_timed_mutex.