Namespaces
Variants
Views
Actions

ATOMIC_VAR_INIT

From cppreference.com
< cpp‎ | atomic
Revision as of 17:07, 2 November 2012 by P12bot (Talk | contribs)

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

<td>
Defined in header <atomic>
</td>

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

<td class="t-dcl-nopad">
#define ATOMIC_VAR_INIT(value) /* implementation-defined */
</td>

<td class="t-dcl-nopad"> </td> <td class="t-dcl-nopad"> </td> </tr> Template:ddcl list end

Expands the an expression which can be used to initialize an std::atomic object that can be initialized from value. If the atomic object has static storage duration, this initialization is constant initialization.

Notes

Accessing the variable during initialization from another thread, even through an atomic operation, is a data race (it may happen if the address is immediately passed to another thread with a std::memory_order_relaxed operation)

This macro is primarily provided for compatibility with C; it behaves the same as the constructor of std::atomic.

Example

See also

Template:cpp/atomic/dcl list atomic initTemplate:cpp/atomic/atomic/dcl list constructor