root / lab4 / .minix-src / include / ddekit / timer.h @ 13
History | View | Annotate | Download (1.14 KB)
1 |
#ifndef _DDEKIT_TIMER_H
|
---|---|
2 |
#define _DDEKIT_TIMER_H
|
3 |
|
4 |
#include <ddekit/ddekit.h> |
5 |
#include <ddekit/thread.h> |
6 |
|
7 |
/** \defgroup DDEKit_timer
|
8 |
*
|
9 |
* Timer subsystem
|
10 |
*
|
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.
|
15 |
*/
|
16 |
|
17 |
/** Add a timer event. After the absolute timeout has expired, function fn
|
18 |
* is called with args as arguments.
|
19 |
*
|
20 |
* \ingroup DDEKit_timer
|
21 |
*
|
22 |
* \return >=0 valid timer ID
|
23 |
* \return < 0 error
|
24 |
*/
|
25 |
int ddekit_add_timer(void (*fn)(void *), void *args, unsigned long |
26 |
timeout); |
27 |
|
28 |
/** Delete timer with the corresponding timer id.
|
29 |
*
|
30 |
* \ingroup DDEKit_timer
|
31 |
*/
|
32 |
int ddekit_del_timer(int timer); |
33 |
|
34 |
/** Check whether a timer is pending
|
35 |
*
|
36 |
* \ingroup DDEKit_timer
|
37 |
*
|
38 |
* Linux needs this.
|
39 |
*/
|
40 |
int ddekit_timer_pending(int timer); |
41 |
|
42 |
/** Initialization function, startup timer thread
|
43 |
*
|
44 |
* \ingroup DDEKit_timer
|
45 |
*/
|
46 |
void ddekit_init_timers(void); |
47 |
|
48 |
/** Get the timer thread.
|
49 |
*/
|
50 |
ddekit_thread_t *ddekit_get_timer_thread(void);
|
51 |
|
52 |
#endif
|