VTK
|
Provides support for atomic integers. More...
#include <vtkAtomicInt.h>
Public Member Functions | |
vtkAtomicInt () | |
vtkAtomicInt (T val) | |
T | operator++ () |
T | operator++ (int) |
T | operator-- () |
T | operator-- (int) |
T | operator-= (T val) |
operator T () const | |
T | operator= (T val) |
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.
Definition at line 322 of file vtkAtomicInt.h.
vtkAtomicInt< T >::vtkAtomicInt | ( | ) | [inline] |
Default constructor. Not atomic.
Definition at line 329 of file vtkAtomicInt.h.
vtkAtomicInt< T >::vtkAtomicInt | ( | T | val | ) | [inline] |
Constructor with initialization. Not atomic.
Definition at line 337 of file vtkAtomicInt.h.
T vtkAtomicInt< T >::operator++ | ( | void | ) | [inline] |
Atomic pre-increment.
Definition at line 345 of file vtkAtomicInt.h.
T vtkAtomicInt< T >::operator++ | ( | int | ) | [inline] |
Atomic post-increment.
Definition at line 353 of file vtkAtomicInt.h.
T vtkAtomicInt< T >::operator-- | ( | void | ) | [inline] |
Atomic pre-decrement.
Definition at line 361 of file vtkAtomicInt.h.
T vtkAtomicInt< T >::operator-- | ( | int | ) | [inline] |
Atomic post-decrement.
Definition at line 369 of file vtkAtomicInt.h.
T vtkAtomicInt< T >::operator-= | ( | T | val | ) | [inline] |
Atomic subtraction. Returns value after.
Definition at line 377 of file vtkAtomicInt.h.
vtkAtomicInt< T >::operator T | ( | ) | const [inline] |
Atomic load.
Definition at line 385 of file vtkAtomicInt.h.
T vtkAtomicInt< T >::operator= | ( | T | val | ) | [inline] |
Atomic save.
Definition at line 393 of file vtkAtomicInt.h.