ATOMIC_VAR_INIT - cppreference.com

##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# ATOMIC_VAR_INIT

From cppreference.com
< cpp‎ | atomic

Defined in header `<atomic>` |  |
#define ATOMIC_VAR_INIT(value) /* implementation-defined */ |  |

Expands to 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.

### [edit] 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.

### [edit] Example

| This section is incomplete Reason: no example

### [edit] See also

atomic_init (C++11) | non-atomic initialization of a default-constructed atomic object (function template) [edit]
(constructor) | constructs an atomic object (public member function of `std::atomic`) [edit]

Retrieved from "http://en.cppreference.com/mwiki/index.php?title=cpp/atomic/ATOMIC_VAR_INIT&oldid=63982"
Category:

- Todo no example