Merge branch 'readme' of git://repo.or.cz/notion/jeffpc into readme
[notion.git] / libmainloop / signal.h
blobd501f7158b39a36511cabd04435148077ff5c707
1 /*
2 * ion/mainloop/signal.h
4 * Copyright (c) Tuomo Valkonen 1999-2009.
6 * See the included file LICENSE for details.
7 */
9 #ifndef ION_LIBMAINLOOP_SIGNAL_H
10 #define ION_LIBMAINLOOP_SIGNAL_H
12 #include <sys/time.h>
13 #include <sys/signal.h>
14 #include <signal.h>
15 #include <time.h>
16 #include <unistd.h>
18 #include <libtu/obj.h>
19 #include <libtu/types.h>
20 #include <libextl/extl.h>
22 #include "hooks.h"
24 INTRCLASS(WTimer);
26 typedef void WTimerHandler(WTimer *timer, Obj *obj);
29 DECLCLASS(WTimer){
30 Obj obj;
31 struct timeval when;
32 WTimer *next;
33 WTimerHandler *handler;
34 Watch objwatch;
35 ExtlFn extl_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,
45 Obj *obj);
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 */