21#ifndef G_NET_TIMER_LIST_H
22#define G_NET_TIMER_LIST_H
73 G_EXCEPTION( NoInstance ,
tx(
"no TimerList instance") )
94 std::pair<G::TimeInterval,bool>
interval()
const ;
131 bool operator==(
const ListItem & v )
const noexcept ;
135 using List = std::vector<ListItem> ;
140 Lock(
const Lock & ) = delete ;
141 Lock( Lock && ) = delete ;
142 Lock & operator=(
const Lock & ) = delete ;
143 Lock & operator=( Lock && ) = delete ;
146 friend class GNet::TimerListTest ;
153 void purgeRemoved() ;
155 void doTimeout( ListItem & ) ;
156 static void removeFrom( List & ,
TimerBase * ) noexcept ;
161 mutable const TimerBase * m_soonest{
nullptr} ;
162 unsigned int m_adjust{0} ;
163 bool m_locked{
false} ;
164 bool m_removed{
false} ;
A lightweight object containing an ExceptionHandler pointer, optional ExceptionSource pointer and opt...
An abstract interface for handling exceptions thrown out of event-loop callbacks (socket/future event...
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.
void add(TimerBase &, EventState)
Adds a timer. Called from the Timer constructor.
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.
constexpr const char * tx(const char *p) noexcept
A briefer alternative to G::gettext_noop().