extern volatile ticks_t _clock;
+#define TIMER_AFTER(x, y) ((long)(y) - (long)(x) < 0)
+#define TIMER_BEFORE(x, y) TIMER_AFTER(y, x)
+
/**
* \brief Return the system tick counter (expressed in ticks)
*
event_initSoftint(&timer->expire, func, user_data);
}
-/** Set the timer delay (the time before the event will be triggered) */
+/**
+ * Set the timer delay (the time before the event will be triggered)
+ *
+ * \note It's illegal to change the delay of the timer when it's
+ * still running.
+ */
INLINE void timer_setDelay(Timer *timer, ticks_t delay)
{
timer->_delay = delay;
#if defined(CONFIG_KERN_SIGNALS) && CONFIG_KERN_SIGNALS
+/** Set the timer so that it sends a event notification when it expires */
+INLINE void timer_setEvent(Timer *timer)
+{
+ event_initGeneric(&timer->expire);
+}
+
+/** Wait until the timer expires */
+INLINE void timer_waitEvent(Timer *timer)
+{
+ event_wait(&timer->expire);
+}
+
/** Set the timer so that it sends a signal when it expires */
INLINE void timer_setSignal(Timer *timer, struct Process *proc, sigmask_t sigs)
{