2 This file is part of libmspcore
3 Copyright © 2006 Mikko Rasa, Mikkosoft Productions
4 Distributed under the LGPL
28 Timer::Slot &Timer::add(const TimeDelta &td)
38 Timer::Slot &Timer::add(const TimeStamp &ts)
48 void Timer::tick(bool block)
58 Slot *next=slots.top();
61 const TimeStamp &stamp=next->get_timeout();
62 const TimeStamp t=now();
63 if(stamp<=t || (block && sem.wait(stamp-t)==1))
66 if(next->signal_timeout.emit() && next->increment())
73 bool Timer::slot_compare(Slot *a, Slot *b)
79 Timer::Slot::Slot(const TimeDelta &td):
81 timeout(now()+interval)
84 Timer::Slot::Slot(const TimeStamp &ts):
88 bool Timer::Slot::increment()
96 bool Timer::Slot::operator<(const Slot &other) const
98 return timeout<other.timeout;