… | |
… | |
29 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
30 | */ |
30 | */ |
31 | #ifndef _EVENT_H_ |
31 | #ifndef _EVENT_H_ |
32 | #define _EVENT_H_ |
32 | #define _EVENT_H_ |
33 | |
33 | |
|
|
34 | #include "ev.h" |
|
|
35 | |
34 | #ifdef __cplusplus |
36 | #ifdef __cplusplus |
35 | extern "C" { |
37 | extern "C" { |
36 | #endif |
38 | #endif |
37 | |
|
|
38 | #include "ev.h" |
|
|
39 | |
39 | |
40 | struct event |
40 | struct event |
41 | { |
41 | { |
42 | /* libev watchers we map onto */ |
42 | /* libev watchers we map onto */ |
43 | union { |
43 | union { |
… | |
… | |
52 | void *ev_arg; |
52 | void *ev_arg; |
53 | int ev_fd; |
53 | int ev_fd; |
54 | int ev_pri; |
54 | int ev_pri; |
55 | int ev_res; |
55 | int ev_res; |
56 | short ev_events; |
56 | short ev_events; |
|
|
57 | |
|
|
58 | char initialised; /* flag to work around some idiosynchrasies in the API */ |
57 | }; |
59 | }; |
58 | |
60 | |
59 | #define EV_PERSIST 0x10 |
61 | #define EV_PERSIST 0x10 |
60 | |
62 | |
61 | #define EVENT_SIGNAL(ev) ((int) (ev)->ev_fd) |
63 | #define EVENT_SIGNAL(ev) ((int) (ev)->ev_fd) |
62 | #define EVENT_FD(ev) ((int) (ev)->ev_fd) |
64 | #define EVENT_FD(ev) ((int) (ev)->ev_fd) |
63 | |
65 | |
64 | #define event_initialized(ev) 1 |
66 | #define event_initialized(ev) ((ev)->initialised) |
65 | |
67 | |
66 | #define evtimer_add(ev,tv) event_add (ev, tv) |
68 | #define evtimer_add(ev,tv) event_add (ev, tv) |
67 | #define evtimer_set(ev,cb,data) event_set (ev, -1, 0, cb, data) |
69 | #define evtimer_set(ev,cb,data) event_set (ev, -1, 0, cb, data) |
68 | #define evtimer_del(ev) event_del (ev) |
70 | #define evtimer_del(ev) event_del (ev) |
69 | #define evtimer_pending(ev,tv) event_pending (ev, EV_TIMEOUT, tv) |
71 | #define evtimer_pending(ev,tv) event_pending (ev, EV_TIMEOUT, tv) |
… | |
… | |
117 | int event_base_loopexit (struct event_base *base, struct timeval *tv); |
119 | int event_base_loopexit (struct event_base *base, struct timeval *tv); |
118 | int event_base_dispatch (struct event_base *base); |
120 | int event_base_dispatch (struct event_base *base); |
119 | int event_base_once (struct event_base *base, int fd, short events, void (*cb)(int, short, void *), void *arg, struct timeval *tv); |
121 | int event_base_once (struct event_base *base, int fd, short events, void (*cb)(int, short, void *), void *arg, struct timeval *tv); |
120 | int event_base_priority_init (struct event_base *base, int fd); |
122 | int event_base_priority_init (struct event_base *base, int fd); |
121 | |
123 | |
|
|
124 | #ifndef EV_STANDALONE |
|
|
125 | # include "event_compat.h" |
122 | #endif |
126 | #endif |
123 | |
127 | |
|
|
128 | #ifdef __cplusplus |
|
|
129 | } |
|
|
130 | #endif |
|
|
131 | |
|
|
132 | #endif |
|
|
133 | |