Contents

class

SushiDSP::LogLineQueue

Carries lines from any number of producer threads to one consumer thread.

Declared in
include/SushiDSP/log/LogLineQueue.hpp

push() and pop() neither block nor allocate; the storage is taken once, at construction.

Public member functions

explicit LogLineQueue(std::size_t capacity)

Allocates the storage for every line the queue can hold.

Parameters

capacity

Rounded up to a power of two, and to at least two.

LogLineQueue(const LogLineQueue &)=delete
LogLineQueue & operator=(const LogLineQueue &)=delete
LogLineQueue(LogLineQueue &&)=delete
LogLineQueue & operator=(LogLineQueue &&)=delete
~LogLineQueue()=default
bool push(const LogRecord &record) noexcept

Copies a line into the queue.

Any thread may call it, several at once.

Returns

False when the queue is full; the line is then not stored.

bool pop(QueuedLogLine &out) noexcept

Moves the oldest line out of the queue.

One thread only.

Returns

False when the queue is empty; out is then untouched.

std::size_t capacity() const noexcept

Returns how many lines the queue holds when full.