Jamba
3.1.0
|
#include <Concurrent.h>
Inherits pongasoft::Utils::Concurrent::LockFree::SingleElementStorage< T >.
Public Member Functions | |
T const * | last () const |
void | last (T &oElement) const |
T * | pop () |
bool | pop (T &oElement) |
T const * | popOrLast () |
void | popOrLast (T &oElement) |
void | push (T const &iElement) |
void | push (T const *iElement) |
SingleElementQueue () | |
SingleElementQueue (std::unique_ptr< T > iElement, bool iIsEmpty=false) | |
template<class ElementModifier > | |
void | updateAndPush (ElementModifier const &iElementModifier) |
template<class ElementModifier > | |
bool | updateAndPushIf (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 Member Functions | |
void | pushValue () |
Private Attributes | |
std::unique_ptr< Element > | fPopValue |
std::unique_ptr< Element > | fPushValue |
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 SingleElementQueue. Internally it uses a different pointer for push and pop. As described in the comment for SingleElementStorage, all methods related to 'pop' can be called in one thread while all methods related to 'push' can be called by another.
|
private |
|
inline |
|
inlineexplicit |
This constructor should be used if T does not provide an empty constructor
|
inline |
|
inline |
Copy the last value that was popped to oElement. Does NOT check for new value
|
inline |
|
inline |
Copy the popped value to oElement and return true when there is a new value otherwise do nothing and return false.
|
inline |
|
inline |
Copy either the new value (if there is one) or the last value that was popped to oElement
|
inline |
Pushes (a copy of) iElement in the queue.
|
inline |
Pushes (a copy of) *iElement in the queue.
|
inlineprivate |
|
inline |
Use this flavor of push to avoid copy. ElementModifier will be called back with the internal pointer to update it.
|
inline |
Use this flavor of push 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 push should happen and false otherwise.
|
private |
|
private |