std::atomic_init
Материал из cppreference.com
|
|
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
| Заголовочный файл <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.
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.
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.
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.
You can help to correct and verify the translation. Click here for instructions.
[править] Исключения
[править] 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.
You can help to correct and verify the translation. Click here for instructions.
[править] Пример
| Этот раздел не завершён Причина: нет примера |
[править] См. также
| (C++11) |
постоянная инициализация атомарных переменных статических продолжительности хранения 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. (функция-макрос) |
| строит атомный объект 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)
| |
| C документация для atomic_init
| |