atomic_flag_test_and_set, atomic_flag_test_and_set_explicit

< c‎ | atomic
Revision as of 15:22, 1 July 2013 by P12bot (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Defined in header <stdatomic.h>
_Bool atomic_flag_test_and_set( volatile atomic_flag* obj );
(1) (since C11)
_Bool atomic_flag_test_and_set_explicit( volatile atomic_flag* obj, memory_order order );
(2) (since C11)

Atomically changes the state of a atomic_flag pointed to by obj to set (true) and returns the previous value. The first version orders memory accesses according to memory_order_seq_cst, the second version orders memory accesses according to order.

[edit] Parameters

obj - pointer to the atomic flag object to modify
order - the memory synchronization ordering for this operation: all values are permitted

[edit] Return value

The previous value held by the atomic flag pointed to by obj.

[edit] See also

sets an atomic_flag to false
(function) [edit]
C++ documentation for atomic_flag_test_and_set, atomic_flag_test_and_set_explicit