1iv_signal(3) ivykis programmer's manual iv_signal(3)
2
3
4
6 IV_SIGNAL_INIT, iv_signal_register, iv_signal_unregister - ivykis sig‐
7 nal handling
8
10 #include <iv_signal.h>
11
12 struct iv_signal {
13 int signum;
14 unsigned int flags;
15 void *cookie;
16 void (*handler)(void *);
17 };
18
19 void IV_SIGNAL_INIT(struct iv_signal *this);
20 int iv_signal_register(struct iv_signal *this);
21 void iv_signal_unregister(struct iv_signal *this);
22
24 iv_signal provides a way for ivykis(3) applications to handle POSIX
25 signals, by integrating them with the ivykis event loop.
26
27 An ivykis application desiring signal notification registers a struct
28 iv_signal object by calling iv_signal_register, after having ini‐
29 tialised it with IV_SIGNAL_INIT and subsequently having filled in the
30 ->signum, ->cookie and ->handler members.
31
32 Once the signal indicated by ->signum is delivered to any thread in the
33 current process, the callback specified by ->handler is scheduled to be
34 called in the thread that the struct iv_signal object was registered
35 in, with ->cookie as its sole argument.
36
37 If the same signal arrives again while the callback function is still
38 running, the callback function is guaranteed to be called again after
39 it returns.
40
41 It is permitted to register multiple struct iv_signal objects for the
42 same signal number. If all such objects are registered with IV_SIG‐
43 NAL_FLAG_EXCLUSIVE in ->flags unset, then all objects will have their
44 callback functions called upon arrival of the signal, in no guaranteed
45 order.
46
47 Invoking callback functions stops at the first struct iv_signal object
48 with IV_SIGNAL_FLAG_EXCLUSIVE in ->flags set, so that if all objects
49 have IV_SIGNAL_FLAG_EXCLUSIVE set, only one callback function will be
50 invoked.
51
52 To deinitialize a struct iv_signal object, call iv_signal_unregister
53 from the same thread that iv_signal_register was called from on that
54 object.
55
56 It is permitted to unregister a struct iv_signal object from any ivykis
57 callback function in the thread it was registered in, including from a
58 callback function triggered by this object, and it is permitted to free
59 the memory corresponding to an unregistered object from its own call‐
60 back function.
61
62 It is guaranteed that signals delivered to child processes that were
63 created by fork(2) but that have not yet called execve(2) will not
64 cause iv_signal callbacks to be invoked in the parent process.
65
66 Internally, iv_signal is implemented using iv_event_raw(3).
67
69 ivykis(3), iv_event_raw(3), sigaction(2)
70
71
72
73ivykis 2010-09-03 iv_signal(3)