RAUL
0.8.0
|
Realtime-safe single-reader single-writer queue (aka lock-free ringbuffer) More...
#include <SRSWQueue.hpp>
Inherits noncopyable.
Public Member Functions | |
SRSWQueue (size_t size) | |
size_t | capacity () const |
bool | full () const |
Return whether or not the queue is full. | |
bool | push (const T &obj) |
Push an item onto the back of the SRSWQueue - realtime-safe, not thread-safe. | |
bool | empty () const |
Return whether or not the queue is empty. | |
T & | front () const |
Return the element at the front of the queue without removing it. | |
void | pop () |
Pop an item off the front of the queue - realtime-safe, not thread-safe. |
Realtime-safe single-reader single-writer queue (aka lock-free ringbuffer)
This is appropriate for a cross-thread queue of fixed size object. If you need to do variable sized reads and writes, use Raul::RingBuffer instead.
Implemented as a dequeue in a fixed array. This is read/write thread-safe, pushing and popping may occur simultaneously by seperate threads, but the push and pop operations themselves are not thread-safe (ie. there can be at most 1 read and at most 1 writer thread).
|
explicit |
size | Size in number of elements |
|
inline |
Push an item onto the back of the SRSWQueue - realtime-safe, not thread-safe.
Referenced by Raul::Maid::push().
|
inline |
Pop an item off the front of the queue - realtime-safe, not thread-safe.
It is a fatal error to call pop() when the queue is empty.
Referenced by Raul::Maid::cleanup().