tmp/tmp748jqfyt/{from.md → to.md}
RENAMED
|
@@ -3,11 +3,11 @@
|
|
| 3 |
``` cpp
|
| 4 |
namespace std {
|
| 5 |
template<class... MutexTypes>
|
| 6 |
class scoped_lock {
|
| 7 |
public:
|
| 8 |
-
using mutex_type =
|
| 9 |
|
| 10 |
explicit scoped_lock(MutexTypes&... m);
|
| 11 |
explicit scoped_lock(adopt_lock_t, MutexTypes&... m);
|
| 12 |
~scoped_lock();
|
| 13 |
|
|
@@ -23,32 +23,35 @@ namespace std {
|
|
| 23 |
An object of type `scoped_lock` controls the ownership of lockable
|
| 24 |
objects within a scope. A `scoped_lock` object maintains ownership of
|
| 25 |
lockable objects throughout the `scoped_lock` object’s lifetime
|
| 26 |
[[basic.life]]. The behavior of a program is undefined if the lockable
|
| 27 |
objects referenced by `pm` do not exist for the entire lifetime of the
|
| 28 |
-
`scoped_lock` object.
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
|
| 33 |
``` cpp
|
| 34 |
explicit scoped_lock(MutexTypes&... m);
|
| 35 |
```
|
| 36 |
|
| 37 |
-
*Preconditions:* If a `MutexTypes` type is not a recursive mutex, the
|
| 38 |
-
calling thread does not own the corresponding mutex element of `m`.
|
| 39 |
-
|
| 40 |
*Effects:* Initializes `pm` with `tie(m...)`. Then if
|
| 41 |
`sizeof...(MutexTypes)` is `0`, no effects. Otherwise if
|
| 42 |
`sizeof...(MutexTypes)` is `1`, then `m.lock()`. Otherwise,
|
| 43 |
`lock(m...)`.
|
| 44 |
|
| 45 |
``` cpp
|
| 46 |
explicit scoped_lock(adopt_lock_t, MutexTypes&... m);
|
| 47 |
```
|
| 48 |
|
| 49 |
-
*Preconditions:* The calling thread
|
|
|
|
| 50 |
|
| 51 |
*Effects:* Initializes `pm` with `tie(m...)`.
|
| 52 |
|
| 53 |
*Throws:* Nothing.
|
| 54 |
|
|
|
|
| 3 |
``` cpp
|
| 4 |
namespace std {
|
| 5 |
template<class... MutexTypes>
|
| 6 |
class scoped_lock {
|
| 7 |
public:
|
| 8 |
+
using mutex_type = see below; // Only if sizeof...(MutexTypes) == 1 is true
|
| 9 |
|
| 10 |
explicit scoped_lock(MutexTypes&... m);
|
| 11 |
explicit scoped_lock(adopt_lock_t, MutexTypes&... m);
|
| 12 |
~scoped_lock();
|
| 13 |
|
|
|
|
| 23 |
An object of type `scoped_lock` controls the ownership of lockable
|
| 24 |
objects within a scope. A `scoped_lock` object maintains ownership of
|
| 25 |
lockable objects throughout the `scoped_lock` object’s lifetime
|
| 26 |
[[basic.life]]. The behavior of a program is undefined if the lockable
|
| 27 |
objects referenced by `pm` do not exist for the entire lifetime of the
|
| 28 |
+
`scoped_lock` object.
|
| 29 |
+
|
| 30 |
+
- If `sizeof...(MutexTypes)` is one, let `Mutex` denote the sole type
|
| 31 |
+
constituting the pack `MutexTypes`. `Mutex` shall meet the
|
| 32 |
+
*Cpp17BasicLockable* requirements [[thread.req.lockable.basic]]. The
|
| 33 |
+
member *typedef-name* `mutex_type` denotes the same type as `Mutex`.
|
| 34 |
+
- Otherwise, all types in the template parameter pack `MutexTypes` shall
|
| 35 |
+
meet the *Cpp17Lockable* requirements [[thread.req.lockable.req]] and
|
| 36 |
+
there is no member `mutex_type`.
|
| 37 |
|
| 38 |
``` cpp
|
| 39 |
explicit scoped_lock(MutexTypes&... m);
|
| 40 |
```
|
| 41 |
|
|
|
|
|
|
|
|
|
|
| 42 |
*Effects:* Initializes `pm` with `tie(m...)`. Then if
|
| 43 |
`sizeof...(MutexTypes)` is `0`, no effects. Otherwise if
|
| 44 |
`sizeof...(MutexTypes)` is `1`, then `m.lock()`. Otherwise,
|
| 45 |
`lock(m...)`.
|
| 46 |
|
| 47 |
``` cpp
|
| 48 |
explicit scoped_lock(adopt_lock_t, MutexTypes&... m);
|
| 49 |
```
|
| 50 |
|
| 51 |
+
*Preconditions:* The calling thread holds a non-shared lock on each
|
| 52 |
+
element of `m`.
|
| 53 |
|
| 54 |
*Effects:* Initializes `pm` with `tie(m...)`.
|
| 55 |
|
| 56 |
*Throws:* Nothing.
|
| 57 |
|