From Jason Turner

[thread.lock.shared.cons]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp1r3qctrz/{from.md → to.md} +107 -0
tmp/tmp1r3qctrz/{from.md → to.md} RENAMED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ##### `shared_lock` constructors, destructor, and assignment <a id="thread.lock.shared.cons">[[thread.lock.shared.cons]]</a>
2
+
3
+ ``` cpp
4
+ shared_lock() noexcept;
5
+ ```
6
+
7
+ *Effects:* Constructs an object of type `shared_lock`.
8
+
9
+ *Postconditions:* `pm == nullptr` and `owns == false`.
10
+
11
+ ``` cpp
12
+ explicit shared_lock(mutex_type& m);
13
+ ```
14
+
15
+ *Requires:* The calling thread does not own the mutex for any ownership
16
+ mode.
17
+
18
+ *Effects:* Constructs an object of type `shared_lock` and calls
19
+ `m.lock_shared()`.
20
+
21
+ *Postconditions:* `pm == &m` and `owns == true`.
22
+
23
+ ``` cpp
24
+ shared_lock(mutex_type& m, defer_lock_t) noexcept;
25
+ ```
26
+
27
+ *Effects:* Constructs an object of type `shared_lock`.
28
+
29
+ *Postconditions:* `pm == &m` and `owns == false`.
30
+
31
+ ``` cpp
32
+ shared_lock(mutex_type& m, try_to_lock_t);
33
+ ```
34
+
35
+ *Requires:* The calling thread does not own the mutex for any ownership
36
+ mode.
37
+
38
+ *Effects:* Constructs an object of type `shared_lock` and calls
39
+ `m.try_lock_shared()`.
40
+
41
+ *Postconditions:* `pm == &m` and `owns == res` where `res` is the value
42
+ returned by the call to `m.try_lock_shared()`.
43
+
44
+ ``` cpp
45
+ shared_lock(mutex_type& m, adopt_lock_t);
46
+ ```
47
+
48
+ *Requires:* The calling thread has shared ownership of the mutex.
49
+
50
+ *Effects:* Constructs an object of type `shared_lock`.
51
+
52
+ *Postconditions:* `pm == &m` and `owns == true`.
53
+
54
+ ``` cpp
55
+ template <class Clock, class Duration>
56
+ shared_lock(mutex_type& m,
57
+ const chrono::time_point<Clock, Duration>& abs_time);
58
+ ```
59
+
60
+ *Requires:* The calling thread does not own the mutex for any ownership
61
+ mode.
62
+
63
+ *Effects:* Constructs an object of type `shared_lock` and calls
64
+ `m.try_lock_shared_until(abs_time)`.
65
+
66
+ *Postconditions:* `pm == &m` and `owns == res` where `res` is the value
67
+ returned by the call to `m.try_lock_shared_until(abs_time)`.
68
+
69
+ ``` cpp
70
+ template <class Rep, class Period>
71
+ shared_lock(mutex_type& m,
72
+ const chrono::duration<Rep, Period>& rel_time);
73
+ ```
74
+
75
+ *Requires:* The calling thread does not own the mutex for any ownership
76
+ mode.
77
+
78
+ *Effects:* Constructs an object of type `shared_lock` and calls
79
+ `m.try_lock_shared_for(rel_time)`.
80
+
81
+ *Postconditions:* `pm == &m` and `owns == res` where `res` is the value
82
+ returned by the call to `m.try_lock_shared_for(rel_time)`.
83
+
84
+ ``` cpp
85
+ ~shared_lock();
86
+ ```
87
+
88
+ *Effects:* If `owns` calls `pm->unlock_shared()`.
89
+
90
+ ``` cpp
91
+ shared_lock(shared_lock&& sl) noexcept;
92
+ ```
93
+
94
+ *Postconditions:* `pm == &sl_p.pm` and `owns == sl_p.owns` (where `sl_p`
95
+ is the state of `sl` just prior to this construction),
96
+ `sl.pm == nullptr` and `sl.owns == false`.
97
+
98
+ ``` cpp
99
+ shared_lock& operator=(shared_lock&& sl) noexcept;
100
+ ```
101
+
102
+ *Effects:* If `owns` calls `pm->unlock_shared()`.
103
+
104
+ *Postconditions:* `pm == &sl_p.pm` and `owns == sl_p.owns` (where `sl_p`
105
+ is the state of `sl` just prior to this assignment), `sl.pm == nullptr`
106
+ and `sl.owns == false`.
107
+