81 : ring_{ring}, sink_{
sink}
94 void start() noexcept;
101 return running_.load(std::memory_order_acquire);
120 void flush() noexcept { std::fflush(sink_); }
128 [[nodiscard]] FILE*
sink() const noexcept {
return sink_; }
131 void run_loop() noexcept;
136 std::atomic<
bool> running_{
false};
137 std::atomic<bool> stop_requested_{
false};
139 SignalConsumerCounters counters_{};
Lock-free single-producer / single-consumer ring buffer.
JSON output thread owner. Non-copyable, non-movable.
~SignalConsumer() noexcept
SignalConsumer(Ring &ring, FILE *sink=stdout) noexcept
Construct bound to the output ring and an I/O sink.
SignalConsumer(const SignalConsumer &)=delete
SignalConsumer & operator=(const SignalConsumer &)=delete
SignalConsumerCounters counters() const noexcept
bool running() const noexcept
Whether the consumer thread is currently running.
SPSCRing< StreamRelativisticSignal, RING_SIZE > Ring
void start() noexcept
Launch the consumer thread. Idempotent.
void stop() noexcept
Stop the consumer thread and perform a final flush. Idempotent.
FILE * sink() const noexcept
static constexpr std::size_t RING_SIZE
SignalConsumer(SignalConsumer &&)=delete
void write_one(const StreamRelativisticSignal &sig) noexcept
Serialise one signal to the sink immediately.
void flush() noexcept
Flush the output sink.
static constexpr std::size_t FLUSH_INTERVAL
Flush every N signals.
SignalConsumer & operator=(SignalConsumer &&)=delete
Lock-free Single-Producer / Single-Consumer ring buffer.
StreamRelativisticSignal — output unit of the signal-processing pipeline.
Diagnostic counters for the signal consumer thread.
std::uint64_t signals_consumed
Total signals written to output.
std::uint64_t flush_count
Number of explicit flushes performed.
Fully-characterised relativistic signal for one processed tick.