|
Jamba C++ API 7.5.0
|
This class encapsulates a single atomic value. More...
#include <Concurrent.h>
Public Member Functions | |
| AtomicValue (std::unique_ptr< T > iValue) | |
| AtomicValue (T const &iValue) | |
| T | get () |
| Returns the "current" value. | |
| void | get (T &oElement) |
| Returns the "current" value. | |
| void | get (T *oElement) |
| Returns the "current" value. | |
| void | set (T const &iValue) |
| Updates the current value with the provided one. | |
| void | set (T const *iValue) |
| Updates the current value with the provided one. | |
Private Attributes | |
| SpinLock | fSpinLock |
| std::unique_ptr< T > | fValue |
This class encapsulates a single atomic value.
This implementation uses a SpinLock and is thread safe to be called by any number of threads. This implementation does not allocate any memory and is expecting the T type to have an empty constructor, copy constructor and operator=.
|
inlineexplicit |
|
inlineexplicit |
|
inline |
Returns the "current" value.
Note that this method should be called by one thread at a time (it is ok to call "set" at the same time with another thread). The return value is copied in the oElement (copy vs creation).
|
inline |
Returns the "current" value.
Note that this method should be called by one thread at a time (it is ok to call "set" at the same time with another thread). The return value is copied in the oElement (copy vs creation).
|
inline |
Returns the "current" value.
Note that this method should be called by one thread at a time (it is ok to call "set" at the same time with another thread). The return value is copied in the oElement (copy vs creation).
|
inline |
Updates the current value with the provided one.
|
inline |
Updates the current value with the provided one.
|
private |
|
private |