28 #ifndef _UCOMMON_TIMERS_H_ 29 #define _UCOMMON_TIMERS_H_ 31 #ifndef _UCOMMON_LINKED_H_ 57 #if _POSIX_TIMERS > 0 && defined(POSIX_TIMERS) 60 #undef POSIX_TIMERS // make sure not used if no support 77 bool is_active(
void)
const;
80 static const timeout_t inf = ((timeout_t)(-1));
81 static const time_t reset = ((time_t)(0));
84 typedef unsigned __int64 tick_t;
86 typedef uint64_t tick_t;
98 Timer(timeout_t offset);
104 Timer(time_t offset);
116 void set(timeout_t expire);
122 void set(time_t expire);
138 timeout_t
get(void)
const;
152 bool operator!()
const;
158 operator bool()
const;
164 Timer& operator=(time_t expire);
170 Timer& operator=(timeout_t expire);
176 Timer& operator+=(time_t expire);
182 Timer& operator+=(timeout_t expire);
188 Timer& operator-=(time_t expire);
194 Timer& operator-=(timeout_t expire);
201 timeout_t operator-(
const Timer& timer);
208 bool operator==(
const Timer& timer)
const;
215 bool operator!=(
const Timer& timer)
const;
222 bool operator<(
const Timer& timer)
const;
229 bool operator<=(
const Timer& timer)
const;
236 bool operator>(
const Timer& timer)
const;
243 bool operator>=(
const Timer& timer)
const;
249 static void sync(
Timer &timer);
255 static tick_t ticks(
void);
285 __DELETE_DEFAULTS(
event);
294 event(timeout_t expire);
306 virtual void expired(
void) = 0;
313 virtual timeout_t timeout(
void);
337 void arm(timeout_t timeout);
348 inline timeout_t
get(void)
const {
352 inline timeout_t operator*()
const {
377 virtual void modify(
void) = 0;
384 virtual void update(
void) = 0;
401 void operator+=(event &timer);
407 void operator-=(event &timer);
TimerQueue::event TQEvent
A convenience type for timer queue timer events.
The conditional is a common base for other thread synchronizing classes.
A timer event object that lives on a timer queue.
T copy(const T &src)
Convenience function to copy objects.
A double linked list object.
timeout_t operator*() const
Get remaining time until timer expires by reference.
A timer queue for timer events.
Timer timer_t
A convenience type for timers.
A portable counting semaphore class.
timeout_t get(void) const
Get remaining time until the timer expires.
Timer class to use when scheduling realtime events.
Linked objects, lists, templates, and containers.
Common namespace for all ucommon objects.
An index container for maintaining an ordered list of objects.
TimerQueue * list(void) const
Get the timer queue we are attached to.