|
lcls2
C++ API: public headers of xtcdata, psalg, psdaq and psana
|
Ring buffer of uint32_t pointers. More...
#include <mpscqueue.hh>
Public Member Functions | |
| MPSCQueue (int capacity) | |
| Allocate a ring of capacity pointers; capacity is used through a mask, so it must be a power of 2. | |
| void | push (uint32_t *value) |
| Claim the next slot, store value in it, wait until earlier pushes have been published, then publish it and wake the consumer if it was waiting on this slot. | |
| uint32_t * | pop () |
| Return the oldest element, blocking while the queue is empty. | |
| bool | is_empty () |
| Return true if all published elements have been popped. | |
| ~MPSCQueue () | |
| Free the ring. | |
Ring buffer of uint32_t pointers.
push() may be called from several threads; pop() from one thread only and blocks until an element is available (per the header comment). There is no check for a full queue.
| MPSCQueue::MPSCQueue | ( | int | capacity | ) |
Allocate a ring of capacity pointers; capacity is used through a mask, so it must be a power of 2.
| MPSCQueue::~MPSCQueue | ( | ) |
Free the ring.
| bool MPSCQueue::is_empty | ( | ) |
Return true if all published elements have been popped.
| uint32_t * MPSCQueue::pop | ( | ) |
Return the oldest element, blocking while the queue is empty.
| void MPSCQueue::push | ( | uint32_t * | value | ) |
Claim the next slot, store value in it, wait until earlier pushes have been published, then publish it and wake the consumer if it was waiting on this slot.