2 * ion/mainloop/signal.h
4 * Copyright (c) Tuomo Valkonen 1999-2009.
6 * See the included file LICENSE for details.
9 #ifndef ION_LIBMAINLOOP_SIGNAL_H
10 #define ION_LIBMAINLOOP_SIGNAL_H
13 #include <sys/signal.h>
18 #include <libtu/obj.h>
19 #include <libtu/types.h>
20 #include <libextl/extl.h>
26 typedef void WTimerHandler(WTimer
*timer
, Obj
*obj
);
33 WTimerHandler
*handler
;
38 extern bool timer_init(WTimer
*timer
);
39 extern void timer_deinit(WTimer
*timer
);
41 extern WTimer
*create_timer();
42 extern WTimer
*create_timer_extl_owned();
44 extern void timer_set(WTimer
*timer
, uint msecs
, WTimerHandler
*handler
,
46 extern void timer_set_extl(WTimer
*timer
, uint msecs
, ExtlFn fn
);
48 extern void timer_reset(WTimer
*timer
);
49 extern bool timer_is_set(WTimer
*timer
);
51 extern bool mainloop_check_signals();
52 extern void mainloop_trap_signals(const sigset_t
*set
);
53 extern void mainloop_block_signals(sigset_t
*oldmask
);
54 extern bool mainloop_unhandled_signals();
55 extern bool libmainloop_get_timeout(struct timeval
*tv
);
57 extern WHook
*mainloop_sigchld_hook
;
58 extern WHook
*mainloop_sigusr2_hook
;
60 /* Returns monotonic time if possible */
61 extern int mainloop_gettime(struct timeval
*val
);
63 #endif /* ION_LIBMAINLOOP_SIGNAL_H */