c/atomic/atomic flag test and set

Atomically changes the state of a pointed to by  to set  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.

The argument is pointer to a volatile atomic flag to accept addresses of both non-volatile and volatile (e.g. memory-mapped I/O) atomic flags.

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