|
Jamoma API
0.6.0.a19
|
First-in/First-out buffer that is non-blocking and thread-safe for writing from a single thread and reading from another (possibly different) single thread. More...
#include <TTFifo.h>
Public Member Functions | |
| void | resize (TTUInt32 &newSlotCount) |
| Change the number of slots in the circular queue. More... | |
| TTFifoWriteStatus | push (const T &item) |
| Copy an item into the queue. More... | |
| TTFifoReadStatus | pop (T &item) |
| Copy the next item and pop it from the queue. More... | |
Protected Attributes | |
| TTAtomicUInt | mUpdateCounter |
| UC – only modified by the producer. | |
| TTAtomicUInt | mAcknowledgementCounter |
| AC – only modified by the consumer. | |
| TTUInt32 | mSlotCount |
| count of slots in mBuffer – should be power of 2, will use as a bitmask | |
| TTUInt32 | mDoubleSlotCount |
| 2 * mBufferSize, cached for performance | |
First-in/First-out buffer that is non-blocking and thread-safe for writing from a single thread and reading from another (possibly different) single thread.
|
inline |
Copy the next item and pop it from the queue.
Definition at line 115 of file TTFifo.h.
References TTFifo< T >::mAcknowledgementCounter, TTFifo< T >::mSlotCount, and TTFifo< T >::mUpdateCounter.
|
inline |
Copy an item into the queue.
Definition at line 83 of file TTFifo.h.
References TTFifo< T >::mAcknowledgementCounter, TTFifo< T >::mDoubleSlotCount, TTFifo< T >::mSlotCount, and TTFifo< T >::mUpdateCounter.
Change the number of slots in the circular queue.
This method should be used with extreme caution as it is not thread-safe with regards to the push() and pop() methods.
| newSlotCount | Must be a power of two. If the argument provided is not a power-of-two, it will be increased to the next-higher power of two upon return. |