|
56 | 56 | // \ref{atomics.types.pointer}, partial specialization for pointers
|
57 | 57 | template<class T> struct atomic<T*>;
|
58 | 58 |
|
| 59 | + // \ref{atomics.types.operations}, initialization |
| 60 | + #define ATOMIC_VAR_INIT(value) @\seebelow@ |
| 61 | + |
59 | 62 | // \ref{atomics.nonmembers}, non-member functions
|
60 | 63 | template<class T>
|
61 | 64 | bool atomic_is_lock_free(const volatile atomic<T>*) noexcept;
|
|
200 | 203 | template<class T>
|
201 | 204 | void atomic_notify_all(atomic<T>*);
|
202 | 205 |
|
203 |
| - // \ref{atomics.types.operations}, initialization |
204 |
| - #define ATOMIC_VAR_INIT(value) @\seebelow@ |
205 |
| - |
206 | 206 | // \ref{atomics.alias}, type aliases
|
207 | 207 | using atomic_bool = atomic<bool>;
|
208 | 208 | using atomic_char = atomic<char>;
|
|
260 | 260 |
|
261 | 261 | // \ref{atomics.flag}, flag type and operations
|
262 | 262 | struct atomic_flag;
|
| 263 | + |
| 264 | + #define ATOMIC_FLAG_INIT @\seebelow@ |
| 265 | + |
263 | 266 | bool atomic_flag_test(const volatile atomic_flag*) noexcept;
|
264 | 267 | bool atomic_flag_test(const atomic_flag*) noexcept;
|
265 | 268 | bool atomic_flag_test_explicit(const volatile atomic_flag*, memory_order) noexcept;
|
|
272 | 275 | void atomic_flag_clear(atomic_flag*) noexcept;
|
273 | 276 | void atomic_flag_clear_explicit(volatile atomic_flag*, memory_order) noexcept;
|
274 | 277 | void atomic_flag_clear_explicit(atomic_flag*, memory_order) noexcept;
|
| 278 | + |
275 | 279 | void atomic_flag_wait(const volatile atomic_flag*, bool) noexcept;
|
276 | 280 | void atomic_flag_wait(const atomic_flag*, bool) noexcept;
|
277 | 281 | void atomic_flag_wait_explicit(const volatile atomic_flag*,
|
|
282 | 286 | void atomic_flag_notify_one(atomic_flag*) noexcept;
|
283 | 287 | void atomic_flag_notify_all(volatile atomic_flag*) noexcept;
|
284 | 288 | void atomic_flag_notify_all(atomic_flag*) noexcept;
|
285 |
| - #define ATOMIC_FLAG_INIT @\seebelow@ |
286 | 289 |
|
287 | 290 | // \ref{atomics.fences}, fences
|
288 | 291 | extern "C" void atomic_thread_fence(memory_order) noexcept;
|
|
2628 | 2631 | atomic_flag& operator=(const atomic_flag&) = delete;
|
2629 | 2632 | atomic_flag& operator=(const atomic_flag&) volatile = delete;
|
2630 | 2633 | };
|
2631 |
| - |
2632 |
| - bool atomic_flag_test(const volatile atomic_flag*) noexcept; |
2633 |
| - bool atomic_flag_test(const atomic_flag*) noexcept; |
2634 |
| - bool atomic_flag_test_explicit(const volatile atomic_flag*, memory_order) noexcept; |
2635 |
| - bool atomic_flag_test_explicit(const atomic_flag*, memory_order) noexcept; |
2636 |
| - bool atomic_flag_test_and_set(volatile atomic_flag*) noexcept; |
2637 |
| - bool atomic_flag_test_and_set(atomic_flag*) noexcept; |
2638 |
| - bool atomic_flag_test_and_set_explicit(volatile atomic_flag*, memory_order) noexcept; |
2639 |
| - bool atomic_flag_test_and_set_explicit(atomic_flag*, memory_order) noexcept; |
2640 |
| - void atomic_flag_clear(volatile atomic_flag*) noexcept; |
2641 |
| - void atomic_flag_clear(atomic_flag*) noexcept; |
2642 |
| - void atomic_flag_clear_explicit(volatile atomic_flag*, memory_order) noexcept; |
2643 |
| - void atomic_flag_clear_explicit(atomic_flag*, memory_order) noexcept; |
2644 |
| - |
2645 |
| - void atomic_flag_wait(const volatile atomic_flag*, bool) noexcept; |
2646 |
| - void atomic_flag_wait(const atomic_flag*, bool) noexcept; |
2647 |
| - void atomic_flag_wait_explicit(const volatile atomic_flag*, |
2648 |
| - bool, memory_order) noexcept; |
2649 |
| - void atomic_flag_wait_explicit(const atomic_flag*, |
2650 |
| - bool, memory_order) noexcept; |
2651 |
| - void atomic_flag_notify_one(volatile atomic_flag*) noexcept; |
2652 |
| - void atomic_flag_notify_one(atomic_flag*) noexcept; |
2653 |
| - void atomic_flag_notify_all(volatile atomic_flag*) noexcept; |
2654 |
| - void atomic_flag_notify_all(atomic_flag*) noexcept; |
2655 |
| - |
2656 |
| - #define ATOMIC_FLAG_INIT @\seebelow@ |
2657 | 2634 | }
|
2658 | 2635 | \end{codeblock}
|
2659 | 2636 |
|
|
2668 | 2645 | The \tcode{atomic_flag} type is a standard-layout struct.
|
2669 | 2646 | It has a trivial default constructor and a trivial destructor.
|
2670 | 2647 |
|
| 2648 | +\indexlibrary{\idxcode{ATOMIC_FLAG_INIT}}% |
| 2649 | +\begin{itemdecl} |
| 2650 | +#define ATOMIC_FLAG_INIT @\seebelow@ |
| 2651 | +\end{itemdecl} |
| 2652 | + |
| 2653 | +\begin{itemdescr} |
2671 | 2654 | \pnum
|
| 2655 | +\remarks |
2672 | 2656 | The macro \tcode{ATOMIC_FLAG_INIT} shall be defined in such a way that it can be used to initialize an object of type \tcode{atomic_flag} to the
|
2673 | 2657 | clear state. The macro can be used in the form:
|
2674 | 2658 | \begin{codeblock}
|
|
2678 | 2662 | For a complete static-duration object, that initialization shall be static.
|
2679 | 2663 | Unless initialized with \tcode{ATOMIC_FLAG_INIT}, it is unspecified whether an
|
2680 | 2664 | \tcode{atomic_flag} object has an initial state of set or clear.
|
| 2665 | +\end{itemdescr} |
2681 | 2666 |
|
2682 | 2667 | \indexlibrary{\idxcode{atomic_flag_test}}%
|
2683 | 2668 | \indexlibrary{\idxcode{atomic_flag_test_explicit}}%
|
|
0 commit comments