From Jason Turner

[thread.lock.shared.cons]

Diff to HTML by rtfpessoa

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