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

NAME

6       IV_EVENT_INIT,  iv_event_register, iv_event_unregister, iv_event_post -
7       manage ivykis objects for event notification
8

SYNOPSIS

10       #include <iv_event.h>
11
12       struct iv_event {
13               void            *cookie;
14               void            (*handler)(void *);
15       };
16
17       int IV_EVENT_INIT(struct iv_event *this);
18       int iv_event_register(struct iv_event *this);
19       void iv_event_unregister(struct iv_event *this);
20       void iv_event_post(struct iv_event *this);
21

DESCRIPTION

23       iv_event provides a way for delivering events to  ivykis(3)  recipients
24       across thread boundaries.
25
26       The  intended  event recipient calls IV_EVENT_INIT on a struct iv_event
27       object, fills in ->cookie and ->handler, and then calls iv_event_regis‐
28       ter on the object.
29
30       To  generate an event, call iv_event_post on the previously initialized
31       struct iv_event object.  This will  cause  the  callback  specified  by
32       ->handler  to  be  called in the thread that the struct iv_event object
33       was registered in, with ->cookie as its sole argument.
34
35       To deinitialize a struct iv_event object, call iv_event_unregister from
36       the same thread that iv_event_register was called from on that object.
37
38       It  is permitted to unregister a struct iv_event object from any ivykis
39       callback function in the thread it was registered in, including from  a
40       callback function triggered by this object, and it is permitted to free
41       the memory corresponding to an unregistered object from its  own  call‐
42       back function.
43
44       iv_event_post can be called from the same thread that iv_event_register
45       was called from, or from a different thread within  the  same  process,
46       but  can  not be called from a different process, and can not be called
47       from  signal  handlers.   If  you  need  this  functionality,  look  at
48       iv_event_raw(3).
49
50       Internally,    iv_event    is   implemented   as   a   wrapper   around
51       iv_event_raw(3), and multiplexes multiple struct iv_event objects  over
52       per-thread  struct  iv_event_raw  objects, to save file descriptors and
53       kernel resources.
54

SEE ALSO

56       ivykis(3), iv_event_raw(3)
57
58
59
60ivykis                            2010-09-03                       iv_event(3)
Impressum