tmp/tmpuf0ci1e3/{from.md → to.md}
RENAMED
|
@@ -10,81 +10,81 @@ unique_lock() noexcept;
|
|
| 10 |
|
| 11 |
``` cpp
|
| 12 |
explicit unique_lock(mutex_type& m);
|
| 13 |
```
|
| 14 |
|
| 15 |
-
If `mutex_type` is not a recursive mutex the calling thread
|
| 16 |
-
the mutex.
|
| 17 |
|
| 18 |
*Effects:* Constructs an object of type `unique_lock` and calls
|
| 19 |
`m.lock()`.
|
| 20 |
|
| 21 |
-
*Postconditions:* `pm ==
|
| 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 ==
|
| 30 |
|
| 31 |
``` cpp
|
| 32 |
unique_lock(mutex_type& m, try_to_lock_t);
|
| 33 |
```
|
| 34 |
|
| 35 |
-
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 ==
|
| 43 |
-
returned by the call to `m.try_lock()`.
|
| 44 |
|
| 45 |
``` cpp
|
| 46 |
unique_lock(mutex_type& m, adopt_lock_t);
|
| 47 |
```
|
| 48 |
|
| 49 |
-
The calling thread
|
| 50 |
|
| 51 |
*Effects:* Constructs an object of type `unique_lock`.
|
| 52 |
|
| 53 |
-
*Postconditions:* `pm ==
|
| 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 |
-
If `mutex_type` is not a recursive mutex the calling thread
|
| 63 |
-
the mutex. The supplied `Mutex` type shall meet the
|
| 64 |
-
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 ==
|
| 70 |
-
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 |
-
If `mutex_type` is not a recursive mutex the calling thread
|
| 78 |
-
the mutex. The supplied `Mutex` type shall meet the
|
| 79 |
-
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 ==
|
| 85 |
-
returned by the call to `m.try_lock_for(rel_time)`.
|
| 86 |
|
| 87 |
``` cpp
|
| 88 |
unique_lock(unique_lock&& u) noexcept;
|
| 89 |
```
|
| 90 |
|
|
@@ -100,13 +100,13 @@ unique_lock& operator=(unique_lock&& u);
|
|
| 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 |
-
With a recursive mutex it is possible for both `*this` and
|
| 106 |
-
the same mutex before the assignment. In this case, `*this`
|
| 107 |
-
mutex after the assignment and `u` will not.
|
| 108 |
|
| 109 |
*Throws:* Nothing.
|
| 110 |
|
| 111 |
``` cpp
|
| 112 |
~unique_lock();
|
|
|
|
| 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 |
|
|
|
|
| 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*]
|
| 108 |
|
| 109 |
*Throws:* Nothing.
|
| 110 |
|
| 111 |
``` cpp
|
| 112 |
~unique_lock();
|