From Jason Turner

[thread.sharedmutex.class]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpx94xxzj4/{from.md → to.md} +45 -0
tmp/tmpx94xxzj4/{from.md → to.md} RENAMED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ##### Class shared_mutex <a id="thread.sharedmutex.class">[[thread.sharedmutex.class]]</a>
2
+
3
+ ``` cpp
4
+ namespace std {
5
+ class shared_mutex {
6
+ public:
7
+ shared_mutex();
8
+ ~shared_mutex();
9
+
10
+ shared_mutex(const shared_mutex&) = delete;
11
+ shared_mutex& operator=(const shared_mutex&) = delete;
12
+
13
+ // Exclusive ownership
14
+ void lock(); // blocking
15
+ bool try_lock();
16
+ void unlock();
17
+
18
+ // Shared ownership
19
+ void lock_shared(); // blocking
20
+ bool try_lock_shared();
21
+ void unlock_shared();
22
+
23
+ using native_handle_type = implementation-defined; // See~[thread.req.native]
24
+ native_handle_type native_handle(); // See~[thread.req.native]
25
+ };
26
+ }
27
+ ```
28
+
29
+ The class `shared_mutex` provides a non-recursive mutex with shared
30
+ ownership semantics.
31
+
32
+ The class `shared_mutex` shall satisfy all of the shared mutex
33
+ requirements ([[thread.sharedmutex.requirements]]). It shall be a
34
+ standard-layout class (Clause  [[class]]).
35
+
36
+ The behavior of a program is undefined if:
37
+
38
+ - it destroys a `shared_mutex` object owned by any thread,
39
+ - a thread attempts to recursively gain any ownership of a
40
+ `shared_mutex`, or
41
+ - a thread terminates while possessing any ownership of a
42
+ `shared_mutex`.
43
+
44
+ `shared_mutex` may be a synonym for `shared_timed_mutex`.
45
+