tmp/tmp3kv_76xo/{from.md → to.md}
RENAMED
|
@@ -2,22 +2,22 @@
|
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk);
|
| 5 |
```
|
| 6 |
|
| 7 |
-
*
|
| 8 |
|
| 9 |
- no other thread is waiting on `cond`, or
|
| 10 |
- `lk.mutex()` returns the same value for each of the lock arguments
|
| 11 |
supplied by all concurrently waiting (via `wait`, `wait_for`, or
|
| 12 |
`wait_until`) threads.
|
| 13 |
|
| 14 |
*Effects:* Transfers ownership of the lock associated with `lk` into
|
| 15 |
internal storage and schedules `cond` to be notified when the current
|
| 16 |
thread exits, after all objects of thread storage duration associated
|
| 17 |
-
with the current thread have been destroyed. This notification
|
| 18 |
-
|
| 19 |
|
| 20 |
``` cpp
|
| 21 |
lk.unlock();
|
| 22 |
cond.notify_all();
|
| 23 |
```
|
|
@@ -25,11 +25,11 @@ cond.notify_all();
|
|
| 25 |
*Synchronization:* The implied `lk.unlock()` call is sequenced after the
|
| 26 |
destruction of all objects with thread storage duration associated with
|
| 27 |
the current thread.
|
| 28 |
|
| 29 |
[*Note 1*: The supplied lock will be held until the thread exits, and
|
| 30 |
-
care
|
| 31 |
lock ordering issues. After calling `notify_all_at_thread_exit` it is
|
| 32 |
recommended that the thread should be exited as soon as possible, and
|
| 33 |
that no blocking or time-consuming tasks are run on that
|
| 34 |
thread. — *end note*]
|
| 35 |
|
|
|
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk);
|
| 5 |
```
|
| 6 |
|
| 7 |
+
*Preconditions:* `lk` is locked by the calling thread and either
|
| 8 |
|
| 9 |
- no other thread is waiting on `cond`, or
|
| 10 |
- `lk.mutex()` returns the same value for each of the lock arguments
|
| 11 |
supplied by all concurrently waiting (via `wait`, `wait_for`, or
|
| 12 |
`wait_until`) threads.
|
| 13 |
|
| 14 |
*Effects:* Transfers ownership of the lock associated with `lk` into
|
| 15 |
internal storage and schedules `cond` to be notified when the current
|
| 16 |
thread exits, after all objects of thread storage duration associated
|
| 17 |
+
with the current thread have been destroyed. This notification is
|
| 18 |
+
equivalent to:
|
| 19 |
|
| 20 |
``` cpp
|
| 21 |
lk.unlock();
|
| 22 |
cond.notify_all();
|
| 23 |
```
|
|
|
|
| 25 |
*Synchronization:* The implied `lk.unlock()` call is sequenced after the
|
| 26 |
destruction of all objects with thread storage duration associated with
|
| 27 |
the current thread.
|
| 28 |
|
| 29 |
[*Note 1*: The supplied lock will be held until the thread exits, and
|
| 30 |
+
care should be taken to ensure that this does not cause deadlock due to
|
| 31 |
lock ordering issues. After calling `notify_all_at_thread_exit` it is
|
| 32 |
recommended that the thread should be exited as soon as possible, and
|
| 33 |
that no blocking or time-consuming tasks are run on that
|
| 34 |
thread. — *end note*]
|
| 35 |
|