From Jason Turner

[thread.lock.unique.cons]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpd6n2sy9r/{from.md → to.md} +30 -40
tmp/tmpd6n2sy9r/{from.md → to.md} RENAMED
@@ -1,107 +1,97 @@
1
- ##### `unique_lock` constructors, destructor, and assignment <a id="thread.lock.unique.cons">[[thread.lock.unique.cons]]</a>
2
 
3
  ``` cpp
4
  unique_lock() noexcept;
5
  ```
6
 
7
- *Effects:* Constructs an object of type `unique_lock`.
8
-
9
- *Postconditions:* `pm == 0` and `owns == false`.
10
 
11
  ``` cpp
12
  explicit unique_lock(mutex_type& m);
13
  ```
14
 
15
- *Requires:* If `mutex_type` is not a recursive mutex the calling thread
16
- does not own the mutex.
17
 
18
- *Effects:* Constructs an object of type `unique_lock` and calls
19
- `m.lock()`.
20
 
21
- *Postconditions:* `pm == addressof(m)` and `owns == true`.
22
 
23
  ``` cpp
24
  unique_lock(mutex_type& m, defer_lock_t) noexcept;
25
  ```
26
 
27
- *Effects:* Constructs an object of type `unique_lock`.
28
-
29
- *Postconditions:* `pm == addressof(m)` and `owns == false`.
30
 
31
  ``` cpp
32
  unique_lock(mutex_type& m, try_to_lock_t);
33
  ```
34
 
35
- *Requires:* The supplied `Mutex` type shall meet the `Lockable`
36
- requirements ([[thread.req.lockable.req]]). If `mutex_type` is not a
37
  recursive mutex the calling thread does not own the mutex.
38
 
39
- *Effects:* Constructs an object of type `unique_lock` and calls
40
- `m.try_lock()`.
41
 
42
- *Postconditions:* `pm == addressof(m)` and `owns == res`, where `res` is
43
- the value returned by the call to `m.try_lock()`.
44
 
45
  ``` cpp
46
  unique_lock(mutex_type& m, adopt_lock_t);
47
  ```
48
 
49
- *Requires:* The calling thread owns the mutex.
50
 
51
- *Effects:* Constructs an object of type `unique_lock`.
52
-
53
- *Postconditions:* `pm == addressof(m)` and `owns == true`.
54
 
55
  *Throws:* Nothing.
56
 
57
  ``` cpp
58
  template<class Clock, class Duration>
59
  unique_lock(mutex_type& m, const chrono::time_point<Clock, Duration>& abs_time);
60
  ```
61
 
62
- *Requires:* If `mutex_type` is not a recursive mutex the calling thread
63
- does not own the mutex. The supplied `Mutex` type shall meet the
64
- `TimedLockable` requirements ([[thread.req.lockable.timed]]).
65
 
66
- *Effects:* Constructs an object of type `unique_lock` and calls
67
- `m.try_lock_until(abs_time)`.
68
 
69
- *Postconditions:* `pm == addressof(m)` and `owns == res`, where `res` is
70
- the value returned by the call to `m.try_lock_until(abs_time)`.
71
 
72
  ``` cpp
73
  template<class Rep, class Period>
74
  unique_lock(mutex_type& m, const chrono::duration<Rep, Period>& rel_time);
75
  ```
76
 
77
- *Requires:* If `mutex_type` is not a recursive mutex the calling thread
78
- does not own the mutex. The supplied `Mutex` type shall meet the
79
- `TimedLockable` requirements ([[thread.req.lockable.timed]]).
80
 
81
- *Effects:* Constructs an object of type `unique_lock` and calls
82
- `m.try_lock_for(rel_time)`.
83
 
84
- *Postconditions:* `pm == addressof(m)` and `owns == res`, where `res` is
85
- the value returned by the call to `m.try_lock_for(rel_time)`.
86
 
87
  ``` cpp
88
  unique_lock(unique_lock&& u) noexcept;
89
  ```
90
 
91
- *Postconditions:* `pm == u_p.pm` and `owns == u_p.owns` (where `u_p` is
92
- the state of `u` just prior to this construction), `u.pm == 0` and
93
  `u.owns == false`.
94
 
95
  ``` cpp
96
  unique_lock& operator=(unique_lock&& u);
97
  ```
98
 
99
  *Effects:* If `owns` calls `pm->unlock()`.
100
 
101
- *Postconditions:* `pm == u_p.pm` and `owns == u_p.owns` (where `u_p` is
102
- the state of `u` just prior to this construction), `u.pm == 0` and
103
  `u.owns == false`.
104
 
105
  [*Note 1*: With a recursive mutex it is possible for both `*this` and
106
  `u` to own the same mutex before the assignment. In this case, `*this`
107
  will own the mutex after the assignment and `u` will not. — *end note*]
 
1
+ ##### Constructors, destructor, and assignment <a id="thread.lock.unique.cons">[[thread.lock.unique.cons]]</a>
2
 
3
  ``` cpp
4
  unique_lock() noexcept;
5
  ```
6
 
7
+ *Ensures:* `pm == 0` and `owns == false`.
 
 
8
 
9
  ``` cpp
10
  explicit unique_lock(mutex_type& m);
11
  ```
12
 
13
+ *Preconditions:* If `mutex_type` is not a recursive mutex the calling
14
+ thread does not own the mutex.
15
 
16
+ *Effects:* Calls `m.lock()`.
 
17
 
18
+ *Ensures:* `pm == addressof(m)` and `owns == true`.
19
 
20
  ``` cpp
21
  unique_lock(mutex_type& m, defer_lock_t) noexcept;
22
  ```
23
 
24
+ *Ensures:* `pm == addressof(m)` and `owns == false`.
 
 
25
 
26
  ``` cpp
27
  unique_lock(mutex_type& m, try_to_lock_t);
28
  ```
29
 
30
+ *Preconditions:* The supplied `Mutex` type meets the *Cpp17Lockable*
31
+ requirements [[thread.req.lockable.req]]. If `mutex_type` is not a
32
  recursive mutex the calling thread does not own the mutex.
33
 
34
+ *Effects:* Calls `m.try_lock()`.
 
35
 
36
+ *Ensures:* `pm == addressof(m)` and `owns == res`, where `res` is the
37
+ value returned by the call to `m.try_lock()`.
38
 
39
  ``` cpp
40
  unique_lock(mutex_type& m, adopt_lock_t);
41
  ```
42
 
43
+ *Preconditions:* The calling thread owns the mutex.
44
 
45
+ *Ensures:* `pm == addressof(m)` and `owns == true`.
 
 
46
 
47
  *Throws:* Nothing.
48
 
49
  ``` cpp
50
  template<class Clock, class Duration>
51
  unique_lock(mutex_type& m, const chrono::time_point<Clock, Duration>& abs_time);
52
  ```
53
 
54
+ *Preconditions:* If `mutex_type` is not a recursive mutex the calling
55
+ thread does not own the mutex. The supplied `Mutex` type meets the
56
+ *Cpp17TimedLockable* requirements [[thread.req.lockable.timed]].
57
 
58
+ *Effects:* Calls `m.try_lock_until(abs_time)`.
 
59
 
60
+ *Ensures:* `pm == addressof(m)` and `owns == res`, where `res` is the
61
+ value returned by the call to `m.try_lock_until(abs_time)`.
62
 
63
  ``` cpp
64
  template<class Rep, class Period>
65
  unique_lock(mutex_type& m, const chrono::duration<Rep, Period>& rel_time);
66
  ```
67
 
68
+ *Preconditions:* If `mutex_type` is not a recursive mutex the calling
69
+ thread does not own the mutex. The supplied `Mutex` type meets the
70
+ *Cpp17TimedLockable* requirements [[thread.req.lockable.timed]].
71
 
72
+ *Effects:* Calls `m.try_lock_for(rel_time)`.
 
73
 
74
+ *Ensures:* `pm == addressof(m)` and `owns == res`, where `res` is the
75
+ value returned by the call to `m.try_lock_for(rel_time)`.
76
 
77
  ``` cpp
78
  unique_lock(unique_lock&& u) noexcept;
79
  ```
80
 
81
+ *Ensures:* `pm == u_p.pm` and `owns == u_p.owns` (where `u_p` is the
82
+ state of `u` just prior to this construction), `u.pm == 0` and
83
  `u.owns == false`.
84
 
85
  ``` cpp
86
  unique_lock& operator=(unique_lock&& u);
87
  ```
88
 
89
  *Effects:* If `owns` calls `pm->unlock()`.
90
 
91
+ *Ensures:* `pm == u_p.pm` and `owns == u_p.owns` (where `u_p` is the
92
+ state of `u` just prior to this construction), `u.pm == 0` and
93
  `u.owns == false`.
94
 
95
  [*Note 1*: With a recursive mutex it is possible for both `*this` and
96
  `u` to own the same mutex before the assignment. In this case, `*this`
97
  will own the mutex after the assignment and `u` will not. — *end note*]