21#ifndef G_NET_TIMER_LIST_H
22#define G_NET_TIMER_LIST_H
78 G_EXCEPTION( NoInstance ,
"no TimerList instance" ) ;
99 std::pair<G::TimeInterval,bool>
interval()
const ;
121 std::string
report()
const ;
135 bool operator==(
const Value & v )
const noexcept ;
139 using List = std::vector<Value> ;
144 Lock(
const Lock & ) = delete ;
145 Lock( Lock && ) = delete ;
146 void operator=(
const Lock & ) = delete ;
147 void operator=( Lock && ) = delete ;
154 void operator=(
const TimerList & ) = delete ;
155 void operator=(
TimerList && ) = delete ;
158 friend class GNet::TimerListTest ;
163 void purgeRemoved() ;
165 static void removeFrom( List & ,
TimerBase * ) noexcept ;
170 mutable const TimerBase * m_soonest{
nullptr} ;
171 unsigned int m_adjust{0} ;
172 bool m_locked{
false} ;
173 bool m_removed{
false} ;
An abstract interface for handling exceptions thrown out of event-loop callbacks (socket/future event...
A tuple containing an ExceptionHandler interface pointer and a bound 'exception source' pointer.
An interface used by GNet::TimerList to keep track of pending timeouts and to deliver timeout events.
A singleton which maintains a list of all Timer objects, and interfaces to the event loop on their be...
std::pair< G::TimeInterval, bool > interval() const
Returns the interval to the first timer expiry.
void remove(TimerBase &) noexcept
Removes a timer from the list.
void doTimeouts()
Triggers the timeout callbacks of any expired timers.
static bool exists()
Returns true if instance() exists.
void disarm(ExceptionHandler *) noexcept
Resets any matching ExceptionHandler pointers.
void updateOnStart(TimerBase &)
Called by Timer when a timer is started.
static TimerList & instance()
Singleton access. Throws an exception if none.
static TimerList * ptr() noexcept
Singleton access. Returns nullptr if none.
TimerList()
Default constructor.
void updateOnCancel(TimerBase &)
Called by Timer when a timer is cancelled.
void add(TimerBase &, ExceptionSink)
Adds a timer. Called from the Timer constructor.
std::string report() const
Returns a line of text reporting the status of the timer list.