libtcspc.RealTimeBuffer

final class libtcspc.RealTimeBuffer(event_type, threshold, latency_limit, access_tag)[source]

Bases: Node

Processor that buffers events for emission on another thread, with bounded latency.

Like Buffer, but additionally bounds the time an event may wait in the buffer: events are made available to the pump thread when either threshold events have accumulated or the oldest buffered event has been held for latency_limit (whichever comes first). The latency limit is measured in wall-clock time (a steady clock), not in event abstime.

Parameters:
  • event_type (EventType) – The event type to buffer. The input event set must consist only of this type.

  • threshold (int or Param[int]) – Number of events to accumulate before they are made available to the pump thread even if the latency limit has not been reached.

  • latency_limit (int or Param[int]) – Maximum time, in nanoseconds, that an event may remain buffered before it is made available to the pump thread even if fewer than threshold events have accumulated. Must be non-negative and not exceed 24 hours.

  • access_tag (AccessTag) – Tag used to retrieve a BufferAccessor from the ExecutionContext at runtime; the application uses it to drive the pump thread.

Notes

Events handled:

  • Events matching event_type: buffered and re-emitted unchanged on the pump thread.

  • All other event types: rejected at graph build time.

  • End of input: drained, then passed through on the pump thread.

See Buffer and BufferAccessor for the threading contract.

See also

tcspc::real_time_buffer()

The underlying C++ factory function.

BufferAccessor

Runtime accessor providing pump() and halt().