ezEngine  Release 25.03
ezAtomicInteger< T > Class Template Reference

Integer class that can be manipulated in an atomic (i.e. thread-safe) fashion. More...

#include <AtomicInteger.h>

Public Member Functions

 EZ_DECLARE_POD_TYPE ()
 
 ezAtomicInteger ()
 Initializes the value to zero.
 
 ezAtomicInteger (const T value)
 Initializes the object with a value.
 
 ezAtomicInteger (const ezAtomicInteger< T > &value)
 Copy-constructor.
 
ezAtomicIntegeroperator= (T value)
 Assigns a new integer value to this object.
 
ezAtomicIntegeroperator= (const ezAtomicInteger &value)
 Assignment operator.
 
Increment ()
 Increments the internal value and returns the incremented value.
 
Decrement ()
 Decrements the internal value and returns the decremented value.
 
PostIncrement ()
 Increments the internal value and returns the value immediately before the increment.
 
PostDecrement ()
 Decrements the internal value and returns the value immediately before the decrement.
 
void Add (T x)
 
void Subtract (T x)
 
void And (T x)
 
void Or (T x)
 
void Xor (T x)
 
void Min (T x)
 
void Max (T x)
 
Set (T x)
 Sets the internal value to x and returns the original internal value.
 
bool TestAndSet (T expected, T x)
 Sets the internal value to x if the internal value is equal to expected and returns true, otherwise does nothing and returns false.
 
CompareAndSwap (T expected, T x)
 If this is equal to expected, it is set to value. Otherwise it won't be modified. Always returns the previous value of this before the modification.
 
 operator T () const
 

Detailed Description

template<typename T>
class ezAtomicInteger< T >

Integer class that can be manipulated in an atomic (i.e. thread-safe) fashion.


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