class
SushiDSP::AsyncLogSink
Queues each line and lets a worker thread write it to another sink, in order.
- Declared in
include/SushiDSP/log/AsyncLogSink.hpp- Inherits
SushiDSP::ILogSink
write() neither blocks nor allocates: a line that finds the queue full is dropped and counted, and the worker reports the count downstream. See include/SushiDSP/README.md.
Public member functions
AsyncLogSink(std::shared_ptr< ILogSink > downstream, std::size_t queue_capacity)Allocates the queue and starts the worker thread.
Parameters
downstreamReceives every line on the worker thread; must not be null.
queue_capacityLines the queue holds; rounded up to a power of two.
~AsyncLogSink() overrideWrites every queued line downstream, flushes it and joins the worker.
AsyncLogSink(const AsyncLogSink &)=deleteAsyncLogSink & operator=(const AsyncLogSink &)=deleteAsyncLogSink(AsyncLogSink &&)=deleteAsyncLogSink & operator=(AsyncLogSink &&)=deletevirtual void write(const LogRecord &record) noexcept overrideQueues one line, or drops and counts it when the queue is full.
virtual void flush() noexcept overrideBlocks until every line queued before the call is written and flushed downstream.
Precondition
The caller is not the worker thread.
std::uint64_t dropped_count() const noexceptReturns how many lines a full queue has refused.

