Namespaces
Variants
Views
Actions

Difference between revisions of "cpp/atomic/atomic store"

From cppreference.com
< cpp‎ | atomic
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}}
{{ddcl list begin}}
+
{{dcl begin}}
{{ddcl list header | atomic }}
+
{{dcl header | atomic }}
{{ddcl list item | num=1 | notes={{mark since c++11}} | 1=
+
{{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 );
 
}}
 
}}
{{ddcl list item | num=2 | notes={{mark since c++11}} | 1=
+
{{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 );
 
}}
 
}}
{{ddcl list item | num=3 | notes={{mark since c++11}} | 1=
+
{{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);
 
}}
 
}}
{{ddcl list item | num=4 | notes={{mark since c++11}} | 1=
+
{{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);
 
}}
 
}}
{{ddcl list end}}
+
{{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===
  
{{param list begin}}
+
{{par begin}}
{{param list item | obj | pointer to the atomic object to modify}}
+
{{par | obj | pointer to the atomic object to modify}}
{{param list item | desr | the value to store in the atomic object}}
+
{{par | desr | the value to store in the atomic object}}
{{param list item | order | the memory synchronization ordering for this operation: only {{c|std::memory_order_relaxed}}, {{c|std::memory_order_release}} and {{c|std::memory_order_seq_cst}} are permitted.}}
+
{{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.}}
{{param list end}}  
+
{{par end}}  
  
 
===Return value===
 
===Return value===
Line 42: Line 42:
  
 
===See also===
 
===See also===
{{dcl list begin}}
+
{{dsc begin}}
{{dcl list template | cpp/atomic/atomic/dcl list store | mem=std::atomic<T>}}
+
{{dsc inc | cpp/atomic/atomic/dcl list store | mem=std::atomic<T>}}
{{dcl list template | cpp/atomic/dcl list atomic_load}}
+
{{dsc inc | cpp/atomic/dcl list atomic_load}}
{{dcl list template | cpp/atomic/dcl list memory_order}}
+
{{dsc inc | cpp/atomic/dcl list memory_order}}
{{dcl list tfun | cpp/memory/shared_ptr/atomic | title=std::atomic_store{{dcl small|(std::shared_ptr)}}
+
{{dsc tfun | cpp/memory/shared_ptr/atomic | title=std::atomic_store{{dsc small|(std::shared_ptr)}}
<br>std::atomic_store_explicit{{dcl small|(std::shared_ptr)}} | specializes atomic operations for {{c|std::shared_ptr}} }}
+
<br>std::atomic_store_explicit{{dsc small|(std::shared_ptr)}} | specializes atomic operations for {{lc|std::shared_ptr}} }}
{{dcl list see c | c/atomic/atomic_store | atomic_store | atomic_store_explicit}}
+
{{dsc see c | c/atomic/atomic_store | atomic_store | atomic_store_explicit}}
{{dcl list end}}
+
{{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,

                            std::memory_order order);
(3) (since C++11)
template< class T >

void atomic_store_explicit( volatile std::atomic<T>* obj, T desr,

                            std::memory_order order);
(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

Template:cpp/atomic/atomic/dcl list storeTemplate:cpp/atomic/dcl list atomic loadTemplate:cpp/atomic/dcl list memory order
specializes atomic operations for std::shared_ptr
(function template)
C documentation for atomic_store, atomic_store_explicit