From Jason Turner

[thread.mutex.requirements]

Diff to HTML by rtfpessoa

tmp/tmpsniuuoo7/{from.md → to.md} RENAMED
@@ -1,8 +1,8 @@
1
  ### Mutex requirements <a id="thread.mutex.requirements">[[thread.mutex.requirements]]</a>
2
 
3
- #### In general <a id="thread.mutex.requirements.general">[[thread.mutex.requirements.general]]</a>
4
 
5
  A mutex object facilitates protection against data races and allows safe
6
  synchronization of data between execution agents
7
  [[thread.req.lockable]]. An execution agent *owns* a mutex from the time
8
  it successfully calls one of the lock functions until it calls unlock.
@@ -156,13 +156,13 @@ another thread to acquire ownership of that object will fail (for
156
  released ownership with a call to `unlock()`.
157
 
158
  [*Note 4*: After a thread `A` has called `unlock()`, releasing a mutex,
159
  it is possible for another thread `B` to lock the same mutex, observe
160
  that it is no longer in use, unlock it, and destroy it, before thread
161
- `A` appears to have returned from its unlock call. Implementations are
162
- required to handle such scenarios correctly, as long as thread `A`
163
- doesn’t access the mutex after the unlock call returns. These cases
164
  typically occur when a reference-counted object contains a mutex that is
165
  used to protect the reference count. — *end note*]
166
 
167
  The class `mutex` meets all of the mutex requirements
168
  [[thread.mutex.requirements]]. It is a standard-layout class
@@ -218,11 +218,11 @@ ownership for a `recursive_mutex` object, additional calls to
218
  of type `system_error`. A thread shall call `unlock()` once for each
219
  level of ownership acquired by calls to `lock()` and `try_lock()`. Only
220
  when all levels of ownership have been released may ownership be
221
  acquired by another thread.
222
 
223
- The behavior of a program is undefined if:
224
 
225
  - it destroys a `recursive_mutex` object owned by any thread or
226
  - a thread terminates while owning a `recursive_mutex` object.
227
 
228
  #### Timed mutex types <a id="thread.timedmutex.requirements">[[thread.timedmutex.requirements]]</a>
@@ -329,11 +329,11 @@ a call to `unlock()` or the call to `try_lock_for()` or
329
 
330
  The class `timed_mutex` meets all of the timed mutex requirements
331
  [[thread.timedmutex.requirements]]. It is a standard-layout class
332
  [[class.prop]].
333
 
334
- The behavior of a program is undefined if:
335
 
336
  - it destroys a `timed_mutex` object owned by any thread,
337
  - a thread that owns a `timed_mutex` object calls `lock()`,
338
  `try_lock()`, `try_lock_for()`, or `try_lock_until()` on that object,
339
  or
@@ -388,11 +388,11 @@ for a `recursive_timed_mutex` object, additional calls to `try_lock()`,
388
  `unlock()` once for each level of ownership acquired by calls to
389
  `lock()`, `try_lock()`, `try_lock_for()`, and `try_lock_until()`. Only
390
  when all levels of ownership have been released may ownership of the
391
  object be acquired by another thread.
392
 
393
- The behavior of a program is undefined if:
394
 
395
  - it destroys a `recursive_timed_mutex` object owned by any thread, or
396
  - a thread terminates while owning a `recursive_timed_mutex` object.
397
 
398
  #### Shared mutex types <a id="thread.sharedmutex.requirements">[[thread.sharedmutex.requirements]]</a>
@@ -517,11 +517,11 @@ ownership semantics.
517
 
518
  The class `shared_mutex` meets all of the shared mutex requirements
519
  [[thread.sharedmutex.requirements]]. It is a standard-layout class
520
  [[class.prop]].
521
 
522
- The behavior of a program is undefined if:
523
 
524
  - it destroys a `shared_mutex` object owned by any thread,
525
  - a thread attempts to recursively gain any ownership of a
526
  `shared_mutex`, or
527
  - a thread terminates while possessing any ownership of a
@@ -643,11 +643,11 @@ shared ownership semantics.
643
 
644
  The class `shared_timed_mutex` meets all of the shared timed mutex
645
  requirements [[thread.sharedtimedmutex.requirements]]. It is a
646
  standard-layout class [[class.prop]].
647
 
648
- The behavior of a program is undefined if:
649
 
650
  - it destroys a `shared_timed_mutex` object owned by any thread,
651
  - a thread attempts to recursively gain any ownership of a
652
  `shared_timed_mutex`, or
653
  - a thread terminates while possessing any ownership of a
 
1
  ### Mutex requirements <a id="thread.mutex.requirements">[[thread.mutex.requirements]]</a>
2
 
3
+ #### General <a id="thread.mutex.requirements.general">[[thread.mutex.requirements.general]]</a>
4
 
5
  A mutex object facilitates protection against data races and allows safe
6
  synchronization of data between execution agents
7
  [[thread.req.lockable]]. An execution agent *owns* a mutex from the time
8
  it successfully calls one of the lock functions until it calls unlock.
 
156
  released ownership with a call to `unlock()`.
157
 
158
  [*Note 4*: After a thread `A` has called `unlock()`, releasing a mutex,
159
  it is possible for another thread `B` to lock the same mutex, observe
160
  that it is no longer in use, unlock it, and destroy it, before thread
161
+ `A` appears to have returned from its unlock call. Conforming
162
+ implementations handle such scenarios correctly, as long as thread `A`
163
+ does not access the mutex after the unlock call returns. These cases
164
  typically occur when a reference-counted object contains a mutex that is
165
  used to protect the reference count. — *end note*]
166
 
167
  The class `mutex` meets all of the mutex requirements
168
  [[thread.mutex.requirements]]. It is a standard-layout class
 
218
  of type `system_error`. A thread shall call `unlock()` once for each
219
  level of ownership acquired by calls to `lock()` and `try_lock()`. Only
220
  when all levels of ownership have been released may ownership be
221
  acquired by another thread.
222
 
223
+ The behavior of a program is undefined if
224
 
225
  - it destroys a `recursive_mutex` object owned by any thread or
226
  - a thread terminates while owning a `recursive_mutex` object.
227
 
228
  #### Timed mutex types <a id="thread.timedmutex.requirements">[[thread.timedmutex.requirements]]</a>
 
329
 
330
  The class `timed_mutex` meets all of the timed mutex requirements
331
  [[thread.timedmutex.requirements]]. It is a standard-layout class
332
  [[class.prop]].
333
 
334
+ The behavior of a program is undefined if
335
 
336
  - it destroys a `timed_mutex` object owned by any thread,
337
  - a thread that owns a `timed_mutex` object calls `lock()`,
338
  `try_lock()`, `try_lock_for()`, or `try_lock_until()` on that object,
339
  or
 
388
  `unlock()` once for each level of ownership acquired by calls to
389
  `lock()`, `try_lock()`, `try_lock_for()`, and `try_lock_until()`. Only
390
  when all levels of ownership have been released may ownership of the
391
  object be acquired by another thread.
392
 
393
+ The behavior of a program is undefined if
394
 
395
  - it destroys a `recursive_timed_mutex` object owned by any thread, or
396
  - a thread terminates while owning a `recursive_timed_mutex` object.
397
 
398
  #### Shared mutex types <a id="thread.sharedmutex.requirements">[[thread.sharedmutex.requirements]]</a>
 
517
 
518
  The class `shared_mutex` meets all of the shared mutex requirements
519
  [[thread.sharedmutex.requirements]]. It is a standard-layout class
520
  [[class.prop]].
521
 
522
+ The behavior of a program is undefined if
523
 
524
  - it destroys a `shared_mutex` object owned by any thread,
525
  - a thread attempts to recursively gain any ownership of a
526
  `shared_mutex`, or
527
  - a thread terminates while possessing any ownership of a
 
643
 
644
  The class `shared_timed_mutex` meets all of the shared timed mutex
645
  requirements [[thread.sharedtimedmutex.requirements]]. It is a
646
  standard-layout class [[class.prop]].
647
 
648
+ The behavior of a program is undefined if
649
 
650
  - it destroys a `shared_timed_mutex` object owned by any thread,
651
  - a thread attempts to recursively gain any ownership of a
652
  `shared_timed_mutex`, or
653
  - a thread terminates while possessing any ownership of a