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
76 bool is_active(
void)
const;
79 #if _MSC_VER > 1400 // windows broken dll linkage issue...
80 static const timeout_t inf = ((timeout_t)(-1));
81 static const time_t reset = ((time_t)(0));
83 static const timeout_t
inf;
88 typedef unsigned __int64 tick_t;
90 typedef uint64_t tick_t;
102 Timer(timeout_t offset);
108 Timer(time_t offset);
120 void set(timeout_t expire);
126 void set(time_t expire);
142 timeout_t
get(void)
const;
155 bool operator!()
const;
161 operator bool()
const;
167 Timer& operator=(time_t expire);
173 Timer& operator=(timeout_t expire);
179 Timer& operator+=(time_t expire);
185 Timer& operator+=(timeout_t expire);
191 Timer& operator-=(time_t expire);
197 Timer& operator-=(timeout_t expire);
204 timeout_t operator-(
const Timer& timer);
211 bool operator==(
const Timer& timer)
const;
218 bool operator!=(
const Timer& timer)
const;
225 bool operator<(
const Timer& timer)
const;
232 bool operator<=(
const Timer& timer)
const;
239 bool operator>(
const Timer& timer)
const;
246 bool operator>=(
const Timer& timer)
const;
252 static void sync(
Timer &timer);
258 static tick_t ticks(
void);
291 event(timeout_t expire);
303 virtual void expired(
void) = 0;
310 virtual timeout_t timeout(
void);
334 void arm(timeout_t timeout);
345 inline timeout_t
get(void)
const
368 virtual void modify(
void) = 0;
375 virtual void update(
void) = 0;
392 void operator+=(event &timer);
398 void operator-=(event &timer);
424 __EXPORT
int gettimeofday(
struct timeval *tv,
void *tz);
The conditional is a common base for other thread synchronizing classes.
Timer timer_t
A convenience type for timers.
TimerQueue::event TQEvent
A convenience type for timer queue timer events.
A timer event object that lives on a timer queue.
ObjectProtocol * copy(ObjectProtocol *object)
Convenience function to access object copy.
Linked objects, lists, templates, and containers.
void modify(accesslock_t &lock)
Convenience function to exclusively schedule conditional access.
timeout_t get(void) const
Get remaining time until the timer expires.
A double linked list object.
timeout_t operator*() const
Get remaining time until timer expires by reference.
An index container for maintaining an ordered list of objects.
A timer queue for timer events.
Common namespace for all ucommon objects.
TimerQueue * list(void) const
Get the timer queue we are attached to.
Timer class to use when scheduling realtime events.
static const time_t reset
A value to use when resetting.
static const timeout_t inf
A value to use for infinite time.
A portable counting semaphore class.