SDL3pp
A slim C++ wrapper for SDL3
Loading...
Searching...
No Matches
Public Member Functions | List of all members
SDL::AtomicPointer< T > Class Template Reference

Type representing an atomic pointer.

Public Member Functions

constexpr AtomicPointer (T *value=nullptr)
 Constructor.
 
 AtomicPointer (const AtomicPointer &value)=delete
 
AtomicPointeroperator= (const AtomicPointer &value)=delete
 
bool CompareAndSwap (T *oldval, T *newval)
 Set a pointer to a new value if it is currently an old value.
 
T * Set (T *v)
 Set a pointer to a value atomically.
 
T * Get ()
 Get the value of a pointer atomically.
 

Member Function Documentation

◆ CompareAndSwap()

template<class T >
bool SDL::AtomicPointer< T >::CompareAndSwap ( T *  oldval,
T *  newval 
)
inline

Note: If you don't know what this function is for, you shouldn't use it!

Parameters
oldvalthe old pointer value.
newvalthe new pointer value.
Returns
true if the pointer was set, false otherwise.
Thread safety:
It is safe to call this function from any thread.
Since
This function is available since SDL 3.2.0.
See also
AtomicInt.CompareAndSwap
AtomicPointer.Get
AtomicPointer.Set

◆ Get()

template<class T >
T * SDL::AtomicPointer< T >::Get ( )
inline

Note: If you don't know what this function is for, you shouldn't use it!

Returns
the current value of a pointer.
Thread safety:
It is safe to call this function from any thread.
Since
This function is available since SDL 3.2.0.
See also
AtomicPointer.CompareAndSwap
AtomicPointer.Set

◆ Set()

template<class T >
T * SDL::AtomicPointer< T >::Set ( T *  v)
inline

Note: If you don't know what this function is for, you shouldn't use it!

Parameters
vthe desired pointer value.
Returns
the previous value of the pointer.
Thread safety:
It is safe to call this function from any thread.
Since
This function is available since SDL 3.2.0.
See also
AtomicPointer.CompareAndSwap
AtomicPointer.Get

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