Jamba
3.0.2
|
#include <Concurrent.h>
Inherits pongasoft::Utils::Concurrent::LockFree::SingleElementStorage< T >.
Public Member Functions | |
AtomicValue (std::unique_ptr< T > iValue) | |
T const * | get () |
void | get (T &oElement) |
void | get (T *oElement) |
T | getCopy () |
void | set (T const &iValue) |
void | set (T const *iValue) |
template<class ElementModifier > | |
void | update (ElementModifier const &iElementModifier) |
template<class ElementModifier > | |
bool | updateIf (ElementModifier const &iElementModifier) |
Public Member Functions inherited from pongasoft::Utils::Concurrent::LockFree::SingleElementStorage< T > | |
bool | __isLockFree () const |
bool | isEmpty () const |
SingleElementStorage (std::unique_ptr< T > iElement, bool iIsEmpty) noexcept | |
~SingleElementStorage () | |
Private Types | |
using | Element = typename SingleElementStorage< T >::Element |
Private Attributes | |
std::unique_ptr< Element > | fGetValue |
std::unique_ptr< Element > | fSetValue |
Additional Inherited Members | |
Protected Member Functions inherited from pongasoft::Utils::Concurrent::LockFree::SingleElementStorage< T > | |
std::unique_ptr< Element > | __newElement () const |
std::unique_ptr< T > | __newT () const |
std::unique_ptr< Element > | load (std::unique_ptr< Element > iElement) |
std::unique_ptr< Element > | store (std::unique_ptr< Element > iElement) |
This is the lock free version of the AtomicValue. Internally it uses a different pointer for get and set. As described in the comment for SingleElementStorage, all methods related to 'get' can be called in one thread while all methods related to 'set' can be called by another.
|
private |
|
inlineexplicit |
|
inline |
|
inline |
Copy the value to oElement
|
inline |
Copy the value to *oElement
|
inline |
|
inline |
Copy the value to make it accessible to get
|
inline |
Copy the value to make it accessible to get
|
inline |
Use this flavor to avoid copy. ElementModifier will be called back with the internal pointer to update it.
|
inline |
Use this flavor to avoid copy. ElementModifier will be called back with the internal pointer to update it.This flavor uses a callback that returns true when the update should happen and false otherwise.
|
private |
|
private |