21#ifndef G_NET_TIMER_LIST_H
22#define G_NET_TIMER_LIST_H
78 G_EXCEPTION( NoInstance ,
tx(
"no TimerList instance") ) ;
99 std::pair<G::TimeInterval,bool>
interval()
const ;
137 bool operator==(
const Value & v )
const noexcept ;
141 using List = std::vector<Value> ;
146 Lock(
const Lock & ) = delete ;
147 Lock( Lock && ) = delete ;
148 Lock & operator=(
const Lock & ) = delete ;
149 Lock & operator=( Lock && ) = delete ;
152 friend class GNet::TimerListTest ;
159 void purgeRemoved() ;
161 void doTimeout( Value & ) ;
162 static void removeFrom( List & ,
TimerBase * ) noexcept ;
167 mutable const TimerBase * m_soonest{
nullptr} ;
168 unsigned int m_adjust{0} ;
169 bool m_locked{
false} ;
170 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.
constexpr const char * tx(const char *p)
A briefer alternative to G::gettext_noop().