VTK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
List of all members
vtkAtomicInt< T > Class Template Reference

Provides support for atomic integers. More...

#include <vtkAtomicInt.h>

Inheritance diagram for vtkAtomicInt< T >:
[legend]
Collaboration diagram for vtkAtomicInt< T >:
[legend]

Public Member Functions

 vtkAtomicInt ()
 
 vtkAtomicInt (T val)
 
operator++ ()
 
operator++ (int)
 
operator-- ()
 
operator-- (int)
 
operator-= (T val)
 
 operator T () const
 
operator= (T val)
 

Detailed Description

template<typename T>
class vtkAtomicInt< T >

Provides support for atomic integers.

Objects of atomic types are C++ objects that are free from data races; that is, if one thread writes to an atomic object while another thread reads from it, the behavior is well-defined. vtkAtomicInt provides a subset of the std::atomic API and implementation, mainly for 32 bit and 64 bit signed integers. For these types, vtkAtomicInt defines a number of operations that happen atomically - without interruption by another thread. Furthermore, these operations happen in a sequentially-consistent way and use full memory fences. This means that operations relating to atomic variables happen in the specified order and the results are made visible to other processing cores to guarantee proper sequential operation. Other memory access patterns supported by std::atomic are not currently supported.

Note that when atomic operations are not available on a particular platform or compiler, mutexes, which are significantly slower, are used as a fallback.

Tests:
vtkAtomicInt (Tests)

Definition at line 322 of file vtkAtomicInt.h.

Constructor & Destructor Documentation

template<typename T>
vtkAtomicInt< T >::vtkAtomicInt ( )
inline

Default constructor. Not atomic.

Definition at line 329 of file vtkAtomicInt.h.

template<typename T>
vtkAtomicInt< T >::vtkAtomicInt ( val)
inline

Constructor with initialization. Not atomic.

Definition at line 337 of file vtkAtomicInt.h.

Member Function Documentation

template<typename T>
T vtkAtomicInt< T >::operator++ ( void  )
inline

Atomic pre-increment.

Definition at line 345 of file vtkAtomicInt.h.

template<typename T>
T vtkAtomicInt< T >::operator++ ( int  )
inline

Atomic post-increment.

Definition at line 353 of file vtkAtomicInt.h.

template<typename T>
T vtkAtomicInt< T >::operator-- ( void  )
inline

Atomic pre-decrement.

Definition at line 361 of file vtkAtomicInt.h.

template<typename T>
T vtkAtomicInt< T >::operator-- ( int  )
inline

Atomic post-decrement.

Definition at line 369 of file vtkAtomicInt.h.

template<typename T>
T vtkAtomicInt< T >::operator-= ( val)
inline

Atomic subtraction. Returns value after.

Definition at line 377 of file vtkAtomicInt.h.

template<typename T>
vtkAtomicInt< T >::operator T ( ) const
inline

Atomic load.

Definition at line 385 of file vtkAtomicInt.h.

template<typename T>
T vtkAtomicInt< T >::operator= ( val)
inline

Atomic save.

Definition at line 393 of file vtkAtomicInt.h.


The documentation for this class was generated from the following file: