Namespaces
Variants
Views
Actions

atomic_flag_test_and_set, atomic_flag_test_and_set_explicit

From cppreference.com
< c‎ | atomic
Revision as of 22:26, 2 November 2012 by P12bot (Talk | contribs)

Template:ddcl list begin <tr class="t-dsc-header">

<td>
Defined in header <stdatomic.h>
</td>

<td></td> <td></td> <tr class="t-dcl ">

<td >
_Bool atomic_flag_test_and_set( volatile atomic_flag* obj );
</td>

<td > (1) </td> <td > (since C11) </td> </tr> <tr class="t-dcl ">

<td >
_Bool atomic_flag_test_and_set_explicit( volatile atomic_flag* obj, memory_order order );
</td>

<td > (2) </td> <td > (since C11) </td> </tr> Template:ddcl list end

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.

Parameters

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

Return value

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

See also

Template:c/atomic/dcl list atomic flag clear
C++ documentation for atomic_flag_test_and_set, atomic_flag_test_and_set_explicit