Documentation Home >> Headers >> <atomic> Header >> std::atomic >> specializations >> std::atomic<integral-type> >> std::atomic_init Non-member Function

Non-atomically store the supplied value in an instance of std::atomic<integral-type>.

void atomic_init(
    atomic<integral-type> volatile* p,
    integral-type v);

Effects:

Non-atomically store the value of v in *p.

Note:

Since this store is non-atomic, any concurrent access to the object pointed to by p from another thread (even with atomic operations) constitutes a data race.

Throws:

Nothing.

Header

#include <atomic>

See Also