1 #ifndef _DDEKIT_TIMER_H
2 #define _DDEKIT_TIMER_H
4 #include <ddekit/ddekit.h>
5 #include <ddekit/thread.h>
7 /** \defgroup DDEKit_timer
11 * DDEKit provides a generic timer implementation that enables users
12 * to execute a function with some arguments after a certain period
13 * of time. DDEKit therefore starts a timer thread that executes these
14 * functions and keeps track of the currently running timers.
17 /** Add a timer event. After the absolute timeout has expired, function fn
18 * is called with args as arguments.
20 * \ingroup DDEKit_timer
22 * \return >=0 valid timer ID
25 int ddekit_add_timer(void (*fn
)(void *), void *args
, unsigned long
28 /** Delete timer with the corresponding timer id.
30 * \ingroup DDEKit_timer
32 int ddekit_del_timer(int timer
);
34 /** Check whether a timer is pending
36 * \ingroup DDEKit_timer
40 int ddekit_timer_pending(int timer
);
42 /** Initialization function, startup timer thread
44 * \ingroup DDEKit_timer
46 void ddekit_init_timers(void);
48 /** Get the timer thread.
50 ddekit_thread_t
*ddekit_get_timer_thread(void);