[ Web Proxy ]
URL:
Viewing: https://ru.cppreference.com/cpp/atomic/atomic_init [Back]  [Original]

std::atomic_init cppreference.com
cppreference.com

std::atomic_init

cppreference.com

<metanoindex/>

<tbody> </tbody>
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. : , , .
:
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.
Google.
. .
obj -, .
:
If obj was not default-constructed, the behavior is undefined.
Google.
. .
obj, .
:
If this function is called twice on the same obj, the behavior is undefined.
Google.
. .

obj
:
pointer to an atomic object to initialize
Google.
. .
desired
:
the value to initialize atomic object with
Google.
. .

()

noexcept:  
noexcept
  

. , std::atomic .
:
This function is provided for compatibility with C. If the compatibility is not required, std::atomic may be initialized through their non-default constructors.
Google.
. .

.

(C++11)( C++20)

(-) []

(public - std::atomic) []
C atomic_init

Web Proxy Viewer  |  New URL  |  Original Page