1iv_timer(3)               ivykis programmer's manual               iv_timer(3)
2
3
4

NAME

6       iv_timer_register, iv_timer_unregister, iv_timer_registered - deal with
7       ivykis timers
8

SYNOPSIS

10       #include <iv.h>
11
12       struct iv_timer {
13               struct timespec         expires;
14               void                    *cookie;
15               void                    (*handler)(void *);
16       };
17
18       void IV_TIMER_INIT(struct iv_timer *timer);
19       void iv_timer_register(struct iv_timer *timer);
20       void iv_timer_unregister(struct iv_timer *timer);
21       int iv_timer_registered(const struct iv_timer *timer);
22

DESCRIPTION

24       The  functions  iv_timer_register  and  iv_timer_unregister   register,
25       respectively unregister, a timer with the current thread's ivykis event
26       loop.  iv_timer_registered on a timer returns true  if  that  timer  is
27       currently registered with ivykis.
28
29       When  a  timer  that  is registered becomes 'ready', due to the current
30       system clock value becoming  greater  than  or  equal  to  the  timer's
31       ->expires member field, the callback function specified by ->handler is
32       called in the thread that the timer was registered in, with ->cookie as
33       its first and sole argument.  When this happens, the timer is transpar‐
34       ently unregistered.
35
36       The application is allowed to change the ->cookie and ->handler members
37       at  any  time.   The application is not allowed to change the ->expires
38       member while the timer is registered.
39
40       A given struct iv_timer can only be registered in one thread at a time,
41       and  a  timer can only be unregistered in the thread that it was regis‐
42       tered from.
43
44       There is no limit on the number of timers registered at once.
45
46       See iv_examples(3) for programming examples.
47

SEE ALSO

49       ivykis(3), iv_examples(3)
50
51
52
53ivykis                            2010-08-15                       iv_timer(3)
Impressum