From Jason Turner

[atomics.flag]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpjxms2ugt/{from.md → to.md} +10 -13
tmp/tmpjxms2ugt/{from.md → to.md} RENAMED
@@ -1,20 +1,20 @@
1
  ## Flag type and operations <a id="atomics.flag">[[atomics.flag]]</a>
2
 
3
  ``` cpp
4
  namespace std {
5
- typedef struct atomic_flag {
6
  bool test_and_set(memory_order = memory_order_seq_cst) volatile noexcept;
7
  bool test_and_set(memory_order = memory_order_seq_cst) noexcept;
8
  void clear(memory_order = memory_order_seq_cst) volatile noexcept;
9
  void clear(memory_order = memory_order_seq_cst) noexcept;
10
 
11
  atomic_flag() noexcept = default;
12
  atomic_flag(const atomic_flag&) = delete;
13
  atomic_flag& operator=(const atomic_flag&) = delete;
14
  atomic_flag& operator=(const atomic_flag&) volatile = delete;
15
- } atomic_flag;
16
 
17
  bool atomic_flag_test_and_set(volatile atomic_flag*) noexcept;
18
  bool atomic_flag_test_and_set(atomic_flag*) noexcept;
19
  bool atomic_flag_test_and_set_explicit(volatile atomic_flag*, memory_order) noexcept;
20
  bool atomic_flag_test_and_set_explicit(atomic_flag*, memory_order) noexcept;
@@ -28,20 +28,17 @@ namespace std {
28
  ```
29
 
30
  The `atomic_flag` type provides the classic test-and-set functionality.
31
  It has two states, set and clear.
32
 
33
- Operations on an object of type `atomic_flag` shall be lock-free. Hence
34
- the operations should also be address-free. No other type requires
35
- lock-free operations, so the `atomic_flag` type is the minimum
36
- hardware-implemented type needed to conform to this International
37
- standard. The remaining types can be emulated with `atomic_flag`, though
38
- with less than ideal properties.
39
 
40
- The `atomic_flag` type shall have standard layout. It shall have a
41
- trivial default constructor, a deleted copy constructor, a deleted copy
42
- assignment operator, and a trivial destructor.
 
 
43
 
44
  The macro `ATOMIC_FLAG_INIT` shall be defined in such a way that it can
45
  be used to initialize an object of type `atomic_flag` to the clear
46
  state. The macro can be used in the form:
47
 
@@ -63,11 +60,11 @@ bool atomic_flag_test_and_set_explicit(atomic_flag* object, memory_order order)
63
  bool atomic_flag::test_and_set(memory_order order = memory_order_seq_cst) volatile noexcept;
64
  bool atomic_flag::test_and_set(memory_order order = memory_order_seq_cst) noexcept;
65
  ```
66
 
67
  *Effects:* Atomically sets the value pointed to by `object` or by `this`
68
- to true. Memory is affected according to the value of `order`. These
69
  operations are atomic read-modify-write
70
  operations ([[intro.multithread]]).
71
 
72
  *Returns:* Atomically, the value of the object immediately before the
73
  effects.
@@ -83,7 +80,7 @@ void atomic_flag::clear(memory_order order = memory_order_seq_cst) noexcept;
83
 
84
  *Requires:* The `order` argument shall not be `memory_order_consume`,
85
  `memory_order_acquire`, nor `memory_order_acq_rel`.
86
 
87
  *Effects:* Atomically sets the value pointed to by `object` or by `this`
88
- to false. Memory is affected according to the value of `order`.
89
 
 
1
  ## Flag type and operations <a id="atomics.flag">[[atomics.flag]]</a>
2
 
3
  ``` cpp
4
  namespace std {
5
+ struct atomic_flag {
6
  bool test_and_set(memory_order = memory_order_seq_cst) volatile noexcept;
7
  bool test_and_set(memory_order = memory_order_seq_cst) noexcept;
8
  void clear(memory_order = memory_order_seq_cst) volatile noexcept;
9
  void clear(memory_order = memory_order_seq_cst) noexcept;
10
 
11
  atomic_flag() noexcept = default;
12
  atomic_flag(const atomic_flag&) = delete;
13
  atomic_flag& operator=(const atomic_flag&) = delete;
14
  atomic_flag& operator=(const atomic_flag&) volatile = delete;
15
+ };
16
 
17
  bool atomic_flag_test_and_set(volatile atomic_flag*) noexcept;
18
  bool atomic_flag_test_and_set(atomic_flag*) noexcept;
19
  bool atomic_flag_test_and_set_explicit(volatile atomic_flag*, memory_order) noexcept;
20
  bool atomic_flag_test_and_set_explicit(atomic_flag*, memory_order) noexcept;
 
28
  ```
29
 
30
  The `atomic_flag` type provides the classic test-and-set functionality.
31
  It has two states, set and clear.
32
 
33
+ Operations on an object of type `atomic_flag` shall be lock-free.
 
 
 
 
 
34
 
35
+ [*Note 1*: Hence the operations should also be
36
+ address-free. *end note*]
37
+
38
+ The `atomic_flag` type is a standard-layout struct. It has a trivial
39
+ default constructor and a trivial destructor.
40
 
41
  The macro `ATOMIC_FLAG_INIT` shall be defined in such a way that it can
42
  be used to initialize an object of type `atomic_flag` to the clear
43
  state. The macro can be used in the form:
44
 
 
60
  bool atomic_flag::test_and_set(memory_order order = memory_order_seq_cst) volatile noexcept;
61
  bool atomic_flag::test_and_set(memory_order order = memory_order_seq_cst) noexcept;
62
  ```
63
 
64
  *Effects:* Atomically sets the value pointed to by `object` or by `this`
65
+ to `true`. Memory is affected according to the value of `order`. These
66
  operations are atomic read-modify-write
67
  operations ([[intro.multithread]]).
68
 
69
  *Returns:* Atomically, the value of the object immediately before the
70
  effects.
 
80
 
81
  *Requires:* The `order` argument shall not be `memory_order_consume`,
82
  `memory_order_acquire`, nor `memory_order_acq_rel`.
83
 
84
  *Effects:* Atomically sets the value pointed to by `object` or by `this`
85
+ to `false`. Memory is affected according to the value of `order`.
86