Difference between revisions of "cpp/atomic/atomic store"
From cppreference.com
m (r2.7.3) (Robot: Adding de, es, fr, it, ja, pt, ru, zh) |
m (Shorten template names. Use {{lc}} where appropriate.) |
||
Line 1: | Line 1: | ||
{{cpp/title|atomic_store|atomic_store_explicit}} | {{cpp/title|atomic_store|atomic_store_explicit}} | ||
{{cpp/atomic/navbar}} | {{cpp/atomic/navbar}} | ||
− | {{ | + | {{dcl begin}} |
− | {{ | + | {{dcl header | atomic }} |
− | {{ | + | {{dcl | num=1 | notes={{mark since c++11}} | 1= |
template< class T > | template< class T > | ||
void atomic_store( std::atomic<T>* obj, T desr ); | void atomic_store( std::atomic<T>* obj, T desr ); | ||
}} | }} | ||
− | {{ | + | {{dcl | num=2 | notes={{mark since c++11}} | 1= |
template< class T > | template< class T > | ||
void atomic_store( volatile std::atomic<T>* obj, T desr ); | void atomic_store( volatile std::atomic<T>* obj, T desr ); | ||
}} | }} | ||
− | {{ | + | {{dcl | num=3 | notes={{mark since c++11}} | 1= |
template< class T > | template< class T > | ||
void atomic_store_explicit( std::atomic<T>* obj, T desr, | void atomic_store_explicit( std::atomic<T>* obj, T desr, | ||
std::memory_order order); | std::memory_order order); | ||
}} | }} | ||
− | {{ | + | {{dcl | num=4 | notes={{mark since c++11}} | 1= |
template< class T > | template< class T > | ||
void atomic_store_explicit( volatile std::atomic<T>* obj, T desr, | void atomic_store_explicit( volatile std::atomic<T>* obj, T desr, | ||
std::memory_order order); | std::memory_order order); | ||
}} | }} | ||
− | {{ | + | {{dcl end}} |
1-2) Atomically replaces the value pointed to by {{tt|obj}} with the value of {{tt|desr}} as if by {{c|obj->store(desr)}} | 1-2) Atomically replaces the value pointed to by {{tt|obj}} with the value of {{tt|desr}} as if by {{c|obj->store(desr)}} | ||
Line 29: | Line 29: | ||
===Parameters=== | ===Parameters=== | ||
− | {{ | + | {{par begin}} |
− | {{ | + | {{par | obj | pointer to the atomic object to modify}} |
− | {{ | + | {{par | desr | the value to store in the atomic object}} |
− | {{ | + | {{par | order | the memory synchronization ordering for this operation: only {{lc|std::memory_order_relaxed}}, {{lc|std::memory_order_release}} and {{lc|std::memory_order_seq_cst}} are permitted.}} |
− | {{ | + | {{par end}} |
===Return value=== | ===Return value=== | ||
Line 42: | Line 42: | ||
===See also=== | ===See also=== | ||
− | {{ | + | {{dsc begin}} |
− | {{ | + | {{dsc inc | cpp/atomic/atomic/dcl list store | mem=std::atomic<T>}} |
− | {{ | + | {{dsc inc | cpp/atomic/dcl list atomic_load}} |
− | {{ | + | {{dsc inc | cpp/atomic/dcl list memory_order}} |
− | {{ | + | {{dsc tfun | cpp/memory/shared_ptr/atomic | title=std::atomic_store{{dsc small|(std::shared_ptr)}} |
− | <br>std::atomic_store_explicit{{ | + | <br>std::atomic_store_explicit{{dsc small|(std::shared_ptr)}} | specializes atomic operations for {{lc|std::shared_ptr}} }} |
− | {{ | + | {{dsc see c | c/atomic/atomic_store | atomic_store | atomic_store_explicit}} |
− | {{ | + | {{dsc end}} |
[[de:cpp/atomic/atomic store]] | [[de:cpp/atomic/atomic store]] |
Revision as of 18:33, 31 May 2013
Defined in header <atomic>
|
||
template< class T > void atomic_store( std::atomic<T>* obj, T desr ); |
(1) | (since C++11) |
template< class T > void atomic_store( volatile std::atomic<T>* obj, T desr ); |
(2) | (since C++11) |
template< class T > void atomic_store_explicit( std::atomic<T>* obj, T desr, |
(3) | (since C++11) |
template< class T > void atomic_store_explicit( volatile std::atomic<T>* obj, T desr, |
(4) | (since C++11) |
1-2) Atomically replaces the value pointed to by obj
with the value of desr
as if by obj->store(desr)
3-4) Atomically replaces the value pointed to by obj
with the value of desr
as if by obj->store(desr, order)
Contents |
Parameters
obj | - | pointer to the atomic object to modify |
desr | - | the value to store in the atomic object |
order | - | the memory synchronization ordering for this operation: only std::memory_order_relaxed, std::memory_order_release and std::memory_order_seq_cst are permitted. |
Return value
none.
Exceptions
noexcept specification:
noexcept
See also
specializes atomic operations for std::shared_ptr (function template) | |
C documentation for atomic_store, atomic_store_explicit
|