… | |
… | |
10 | # define aTHX_ |
10 | # define aTHX_ |
11 | # define pTHX |
11 | # define pTHX |
12 | # define aTHX |
12 | # define aTHX |
13 | #endif |
13 | #endif |
14 | |
14 | |
|
|
15 | /* you MUST NOT call any of the libev functions, ALWAYS use GEVAPI */ |
15 | #include <event.h> |
16 | #include <ev.h> |
16 | |
17 | |
17 | struct EVAPI { |
18 | struct EVAPI { |
18 | I32 ver; |
19 | I32 ver; |
19 | I32 rev; |
20 | I32 rev; |
20 | #define EV_API_VERSION 1 |
21 | #define EV_API_VERSION 1 |
21 | #define EV_API_REVISION 0 |
22 | #define EV_API_REVISION 0 |
22 | |
23 | |
23 | /* return the current wallclock time */ |
|
|
24 | double (*now)(void); |
|
|
25 | |
|
|
26 | /* wait for a single event, without registering an event watcher */ |
24 | /* wait for a single event, without registering an event watcher */ |
27 | /* if timeout is < 0, do wait indefinitely */ |
25 | /* if timeout is < 0, do wait indefinitely */ |
28 | void (*once)(int fd, short events, double timeout, void (*cb)(int, short, void *), void *arg); |
26 | void (*once)(int fd, short events, double timeout, void (*cb)(int, short, void *), void *arg); |
29 | |
27 | |
30 | /* same as event_loop */ |
28 | /* perl fh or fd int to fd */ |
|
|
29 | int (*sv_fileno) (SV *fh); |
|
|
30 | /* signal number/name to signum */ |
|
|
31 | int (*sv_signum) (SV *fh); |
|
|
32 | |
|
|
33 | /* libev global variables (note: references!) */ |
|
|
34 | ev_tstamp *now; |
|
|
35 | int *method; |
|
|
36 | int *loop_done; |
|
|
37 | |
|
|
38 | /* same as libev functions */ |
|
|
39 | ev_tstamp (*(time))(void); |
31 | int (*loop)(int flags); |
40 | void (*loop)(int flags); |
|
|
41 | void (*io_start)(struct ev_io *); |
|
|
42 | void (*io_stop) (struct ev_io *); |
|
|
43 | void (*timer_start)(struct ev_timer *); |
|
|
44 | void (*timer_stop) (struct ev_timer *); |
|
|
45 | void (*periodic_start)(struct ev_periodic *); |
|
|
46 | void (*periodic_stop) (struct ev_periodic *); |
|
|
47 | void (*signal_start)(struct ev_signal *); |
|
|
48 | void (*signal_stop) (struct ev_signal *); |
|
|
49 | void (*idle_start)(struct ev_idle *); |
|
|
50 | void (*idle_stop) (struct ev_idle *); |
|
|
51 | void (*check_start)(struct ev_check *); |
|
|
52 | void (*check_stop) (struct ev_check *); |
32 | }; |
53 | }; |
33 | |
54 | |
34 | /* |
55 | /* |
35 | * usage examples: |
56 | * usage examples: |
36 | * |
57 | * |