Namespaces
Variants
Views
Actions

std::atomic_fetch_add, std::atomic_fetch_add_explicit

From cppreference.com
< cpp‎ | atomic
Revision as of 13:25, 5 January 2012 by P12 (Talk | contribs)

Template:cpp/atomic/sidebar Template:ddcl list begin <tr class="t-dsc-header">

<td>
Defined in header <atomic>
</td>

<td></td> <td></td> </tr> <tr class="t-dcl ">

<td >
template< class Integral >
Integral atomic_fetch_add( std::atomic<Integral>* obj, Integral arg );
</td>

<td > (1) </td> <td > (since C++11) </td> </tr> <tr class="t-dcl ">

<td >
template< class Integral >
Integral atomic_fetch_add( volatile std::atomic<Integral>* obj, Integral arg );
</td>

<td > (2) </td> <td > (since C++11) </td> </tr> <tr class="t-dcl ">

<td >
template< class Integral >

Integral atomic_fetch_add_explicit( std::atomic<Integral>* obj,
                                    Integral arg,

                                    std::memory_order order );
</td>

<td > (3) </td> <td > (since C++11) </td> </tr> <tr class="t-dcl ">

<td >
template< class Integral >

Integral atomic_fetch_add_explicit( volatile std::atomic<Integral>* obj,
                                    Integral arg,

                                    std::memory_order order );
</td>

<td > (4) </td> <td > (since C++11) </td> </tr> <tr class="t-dcl ">

<td >
template< class T >
T* atomic_fetch_add( std::atomic<T*>* obj, std::ptrdiff_t arg );
</td>

<td > (5) </td> <td > (since C++11) </td> </tr> <tr class="t-dcl ">

<td >
template< class T >
T* atomic_fetch_add( volatile std::atomic<T*>* obj, std::ptrdiff_t arg );
</td>

<td > (6) </td> <td > (since C++11) </td> </tr> <tr class="t-dcl ">

<td >
template< class T >

T* atomic_fetch_add_explicit( std::atomic<T*>* obj, std::ptrdiff_t arg,

                              std::memory_order order );
</td>

<td > (7) </td> <td > (since C++11) </td> </tr> <tr class="t-dcl ">

<td >
template< class T >

T* atomic_fetch_add_explicit( volatile std::atomic<T*>* obj, std::ptrdiff_t arg,

                              std::memory_order order );
</td>

<td > (8) </td> <td > (since C++11) </td> </tr> Template:ddcl list end

1-2) Atomically adds arg to the value pointed to by obj and returns the value obj held previously, as if by Template:cpp

3-4) Atomically adds arg to the value pointed to by obj and returns the value obj held previously, as if by Template:cpp

5-6) Atomically increments the pointer value, pointed to by obj, by arg, and returns the value obj held previously, as if by Template:cpp

7-8) Atomically increments the pointer value, pointed to by obj, by arg, and returns the value obj held previously, as if by Template:cpp

Contents

Parameters

obj - pointer to the atomic object to modify
arg - the value to add to the value stored in the atomic object
order - the memory sycnhronization ordering for this operation: all values are permitted.

Return value

The value held previously by the atomic object pointed to by obj

Exceptions

noexcept specification:  
noexcept
  

Equivalent definition

Template:eq fun cpp

Example

Template:example cpp

See also

Template:cpp/atomic/atomic/dcl list fetch addTemplate:cpp/atomic/dcl list atomic fetch sub