libtcspc.Buffer¶
- final class libtcspc.Buffer(event_type, threshold, access_tag)[source]¶
Bases:
NodeProcessor that buffers a single event type for emission on another thread.
A buffer splits the processing graph into a producer half (the processors upstream of this node) and a consumer half (the processors downstream). Events of
event_typeare enqueued by the producer thread (the one drivingExecutionContext.handle/ExecutionContext.flush) and are drained and re-emitted unchanged on a separate pump thread that the application runs viaBufferAccessor.pump. The buffer thus decouples upstream and downstream processing and lets them run concurrently.A heterogeneous event stream can be buffered by composing with
MultiplexandDemultiplexso that a singleVariantEventtype crosses the buffer.- 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.
access_tag (AccessTag) – Tag used to retrieve a
BufferAccessorfrom theExecutionContextat 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.
ExecutionContext.flushreturns once the producer half is flushed; it does not wait for the consumer half to drain. SeeBufferAccessorfor the threading contract.See also
- tcspc::buffer()
The underlying C++ factory function.
BufferAccessorRuntime accessor providing
pump()andhalt().