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. |
| Defined in header <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.
[编辑] 例外
[编辑] 注釋
如果兼容不需要提供此函數是與C的兼容性,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.
[编辑] 為例
| 本節是不完整的 原因: no example |
[编辑] 另請參閱
| (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. (公共成員函數of std::atomic)
| |
| C documentation for atomic_init
| |