Пространства имён
Варианты
Действия

std::atomic_init

Материал из cppreference.com

Заголовочный файл <atomic>
template< class T >
void atomic_init( std::atomic<T>* obj, T desired );
template< class T >
void atomic_init( volatile std::atomic<T>* obj, T desired );
Инициализирует по-умолчанию атомного object объект со значением desired. Функция не является атомарным: одновременный доступ из другого потока, даже через атомарные операции, является данными гонки.
Original:
Initializes the default-constructed atomic object object with the value desired. The function is not atomic: concurrent access from another thread, even through an atomic operation, is a data race.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Если obj не был по-умолчанию, поведение не определено.
Original:
If obj was not default-constructed, the behavior is undefined.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Если эта функция вызывается дважды на той же obj, поведение не определено.
Original:
If this function is called twice on the same obj, the behavior is undefined.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Содержание

[править] Параметры

obj -
Указатель на атомный объект для инициализации
Original:
pointer to an atomic object to initialize
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
desired -
значение для инициализации атомного объекта
Original:
the value to initialize atomic object with
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[править] Возвращаемое значение

(Нет)
Original:
(none)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[править] Исключения

noexcept-спецификация:  
noexcept
  (начиная с C++11)

[править] Notes

Эта функция предоставлена ​​для совместимости с С. Если совместимость не требуется, std::atomic может быть инициализирован через свои нестандартные конструкторы.
Original:
This function is provided for compatibility with C. If the compatibility is not required, std::atomic may be initialized through their non-default constructors.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[править] Пример

[править] См. также

постоянная инициализация атомарных переменных статических продолжительности хранения
Original:
constant initialization of an atomic variable of static storage duration
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(функция-макрос) [edit]
строит атомный объект
Original:
constructs an atomic object
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(public функция-член std::atomic) [edit]
C документация для atomic_init