Loading...
Searching...
No Matches
Process::EventRing< T, N > Class Template Reference

Detailed Description

template<typename T, std::size_t N>
class Process::EventRing< T, N >

Discrete events from the execution thread to the GUI, none lost while they fit: a bounded single-producer queue, which does not allocate when pushing. A full queue drops what is pushed and counts it, so that the view can say so.

Every view refreshed in the same tick of the monitor clock gets the same events (see monitorFrame()); outside of a tick, drain() takes them.

T is copied in and out; keep it small and trivially copyable.

Public Member Functions

 EventRing (const EventRing &)=delete
 
EventRing & operator= (const EventRing &)=delete
 
bool push (const T &e) noexcept
 Writer: false when the ring is full and e was dropped.
 
template<typename F >
int drain (F &&f)
 
uint64_t dropped () const noexcept
 

Member Function Documentation

◆ drain()

template<typename T , std::size_t N>
template<typename F >
int Process::EventRing< T, N >::drain ( F &&  f)
inline

Reader: calls f with every event pushed since the last drain, or, in a tick of the monitor clock, since the previous tick.


The documentation for this class was generated from the following file: