From Jason Turner

[thread.lock.unique.locking]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpta399w_n/{from.md → to.md} +21 -21
tmp/tmpta399w_n/{from.md → to.md} RENAMED
@@ -1,39 +1,39 @@
1
- ##### `unique_lock` locking <a id="thread.lock.unique.locking">[[thread.lock.unique.locking]]</a>
2
 
3
  ``` cpp
4
  void lock();
5
  ```
6
 
7
  *Effects:* As if by `pm->lock()`.
8
 
9
- *Postconditions:* `owns == true`.
10
 
11
  *Throws:* Any exception thrown by `pm->lock()`. `system_error` when an
12
- exception is required ([[thread.req.exception]]).
13
 
14
  *Error conditions:*
15
 
16
  - `operation_not_permitted` — if `pm` is `nullptr`.
17
  - `resource_deadlock_would_occur` — if on entry `owns` is `true`.
18
 
19
  ``` cpp
20
  bool try_lock();
21
  ```
22
 
23
- *Requires:* The supplied `Mutex` shall meet the `Lockable`
24
- requirements ([[thread.req.lockable.req]]).
25
 
26
  *Effects:* As if by `pm->try_lock()`.
27
 
28
  *Returns:* The value returned by the call to `try_lock()`.
29
 
30
- *Postconditions:* `owns == res`, where `res` is the value returned by
31
- the call to `try_lock()`.
32
 
33
  *Throws:* Any exception thrown by `pm->try_lock()`. `system_error` when
34
- an exception is required ([[thread.req.exception]]).
35
 
36
  *Error conditions:*
37
 
38
  - `operation_not_permitted` — if `pm` is `nullptr`.
39
  - `resource_deadlock_would_occur` — if on entry `owns` is `true`.
@@ -41,22 +41,22 @@ an exception is required ([[thread.req.exception]]).
41
  ``` cpp
42
  template<class Clock, class Duration>
43
  bool try_lock_until(const chrono::time_point<Clock, Duration>& abs_time);
44
  ```
45
 
46
- *Requires:* The supplied `Mutex` type shall meet the `TimedLockable`
47
- requirements ([[thread.req.lockable.timed]]).
48
 
49
  *Effects:* As if by `pm->try_lock_until(abs_time)`.
50
 
51
  *Returns:* The value returned by the call to `try_lock_until(abs_time)`.
52
 
53
- *Postconditions:* `owns == res`, where `res` is the value returned by
54
- the call to `try_lock_until(abs_time)`.
55
 
56
  *Throws:* Any exception thrown by `pm->try_lock_until()`. `system_error`
57
- when an exception is required ([[thread.req.exception]]).
58
 
59
  *Error conditions:*
60
 
61
  - `operation_not_permitted` — if `pm` is `nullptr`.
62
  - `resource_deadlock_would_occur` — if on entry `owns` is `true`.
@@ -64,22 +64,22 @@ when an exception is required ([[thread.req.exception]]).
64
  ``` cpp
65
  template<class Rep, class Period>
66
  bool try_lock_for(const chrono::duration<Rep, Period>& rel_time);
67
  ```
68
 
69
- *Requires:* The supplied `Mutex` type shall meet the `TimedLockable`
70
- requirements ([[thread.req.lockable.timed]]).
71
 
72
  *Effects:* As if by `pm->try_lock_for(rel_time)`.
73
 
74
- *Returns:* The value returned by the call to `try_lock_until(rel_time)`.
75
 
76
- *Postconditions:* `owns == res`, where `res` is the value returned by
77
- the call to `try_lock_for(rel_time)`.
78
 
79
  *Throws:* Any exception thrown by `pm->try_lock_for()`. `system_error`
80
- when an exception is required ([[thread.req.exception]]).
81
 
82
  *Error conditions:*
83
 
84
  - `operation_not_permitted` — if `pm` is `nullptr`.
85
  - `resource_deadlock_would_occur` — if on entry `owns` is `true`.
@@ -88,14 +88,14 @@ when an exception is required ([[thread.req.exception]]).
88
  void unlock();
89
  ```
90
 
91
  *Effects:* As if by `pm->unlock()`.
92
 
93
- *Postconditions:* `owns == false`.
94
 
95
  *Throws:* `system_error` when an exception is
96
- required ([[thread.req.exception]]).
97
 
98
  *Error conditions:*
99
 
100
  - `operation_not_permitted` — if on entry `owns` is `false`.
101
 
 
1
+ ##### Locking <a id="thread.lock.unique.locking">[[thread.lock.unique.locking]]</a>
2
 
3
  ``` cpp
4
  void lock();
5
  ```
6
 
7
  *Effects:* As if by `pm->lock()`.
8
 
9
+ *Ensures:* `owns == true`.
10
 
11
  *Throws:* Any exception thrown by `pm->lock()`. `system_error` when an
12
+ exception is required [[thread.req.exception]].
13
 
14
  *Error conditions:*
15
 
16
  - `operation_not_permitted` — if `pm` is `nullptr`.
17
  - `resource_deadlock_would_occur` — if on entry `owns` is `true`.
18
 
19
  ``` cpp
20
  bool try_lock();
21
  ```
22
 
23
+ *Preconditions:* The supplied `Mutex` meets the *Cpp17Lockable*
24
+ requirements [[thread.req.lockable.req]].
25
 
26
  *Effects:* As if by `pm->try_lock()`.
27
 
28
  *Returns:* The value returned by the call to `try_lock()`.
29
 
30
+ *Ensures:* `owns == res`, where `res` is the value returned by the call
31
+ to `try_lock()`.
32
 
33
  *Throws:* Any exception thrown by `pm->try_lock()`. `system_error` when
34
+ an exception is required [[thread.req.exception]].
35
 
36
  *Error conditions:*
37
 
38
  - `operation_not_permitted` — if `pm` is `nullptr`.
39
  - `resource_deadlock_would_occur` — if on entry `owns` is `true`.
 
41
  ``` cpp
42
  template<class Clock, class Duration>
43
  bool try_lock_until(const chrono::time_point<Clock, Duration>& abs_time);
44
  ```
45
 
46
+ *Preconditions:* The supplied `Mutex` type meets the
47
+ *Cpp17TimedLockable* requirements [[thread.req.lockable.timed]].
48
 
49
  *Effects:* As if by `pm->try_lock_until(abs_time)`.
50
 
51
  *Returns:* The value returned by the call to `try_lock_until(abs_time)`.
52
 
53
+ *Ensures:* `owns == res`, where `res` is the value returned by the call
54
+ to `try_lock_until(abs_time)`.
55
 
56
  *Throws:* Any exception thrown by `pm->try_lock_until()`. `system_error`
57
+ when an exception is required [[thread.req.exception]].
58
 
59
  *Error conditions:*
60
 
61
  - `operation_not_permitted` — if `pm` is `nullptr`.
62
  - `resource_deadlock_would_occur` — if on entry `owns` is `true`.
 
64
  ``` cpp
65
  template<class Rep, class Period>
66
  bool try_lock_for(const chrono::duration<Rep, Period>& rel_time);
67
  ```
68
 
69
+ *Preconditions:* The supplied `Mutex` type meets the
70
+ *Cpp17TimedLockable* requirements [[thread.req.lockable.timed]].
71
 
72
  *Effects:* As if by `pm->try_lock_for(rel_time)`.
73
 
74
+ *Returns:* The value returned by the call to `try_lock_for(rel_time)`.
75
 
76
+ *Ensures:* `owns == res`, where `res` is the value returned by the call
77
+ to `try_lock_for(rel_time)`.
78
 
79
  *Throws:* Any exception thrown by `pm->try_lock_for()`. `system_error`
80
+ when an exception is required [[thread.req.exception]].
81
 
82
  *Error conditions:*
83
 
84
  - `operation_not_permitted` — if `pm` is `nullptr`.
85
  - `resource_deadlock_would_occur` — if on entry `owns` is `true`.
 
88
  void unlock();
89
  ```
90
 
91
  *Effects:* As if by `pm->unlock()`.
92
 
93
+ *Ensures:* `owns == false`.
94
 
95
  *Throws:* `system_error` when an exception is
96
+ required [[thread.req.exception]].
97
 
98
  *Error conditions:*
99
 
100
  - `operation_not_permitted` — if on entry `owns` is `false`.
101