… | |
… | |
5 | /*#include <netinet/in.h>*/ |
5 | /*#include <netinet/in.h>*/ |
6 | |
6 | |
7 | #define EV_PROTOTYPES 1 |
7 | #define EV_PROTOTYPES 1 |
8 | #include "EV/EVAPI.h" |
8 | #include "EV/EVAPI.h" |
9 | |
9 | |
|
|
10 | /* fix perl api breakage */ |
|
|
11 | #undef signal |
|
|
12 | #undef sigaction |
|
|
13 | |
|
|
14 | /* due to bugs in OS X we have to use libev/ explicitly here */ |
10 | #include "libev/ev.c" |
15 | #include "libev/ev.c" |
11 | #include "libev/event.h" |
|
|
12 | #include "libev/event.c" |
16 | #include "event.c" |
|
|
17 | |
|
|
18 | #ifndef WIN32 |
13 | #define DNS_USE_GETTIMEOFDAY_FOR_ID 1 |
19 | #define DNS_USE_GETTIMEOFDAY_FOR_ID 1 |
|
|
20 | #if !defined (WIN32) && !defined(__CYGWIN__) |
14 | #define HAVE_STRUCT_IN6_ADDR 1 |
21 | # define HAVE_STRUCT_IN6_ADDR 1 |
|
|
22 | #endif |
15 | #undef HAVE_STRTOK_R |
23 | #undef HAVE_STRTOK_R |
16 | #undef strtok_r |
24 | #undef strtok_r |
17 | #define strtok_r fake_strtok_r |
25 | #define strtok_r fake_strtok_r |
18 | #include "libev/evdns.h" |
|
|
19 | #include "libev/evdns.c" |
26 | #include "evdns.c" |
|
|
27 | #endif |
|
|
28 | |
|
|
29 | #ifndef WIN32 |
|
|
30 | # include <pthread.h> |
|
|
31 | #endif |
20 | |
32 | |
21 | typedef int Signal; |
33 | typedef int Signal; |
22 | |
34 | |
23 | static struct EVAPI evapi; |
35 | static struct EVAPI evapi; |
24 | |
36 | |
… | |
… | |
95 | w->self = self; |
107 | w->self = self; |
96 | |
108 | |
97 | return (void *)w; |
109 | return (void *)w; |
98 | } |
110 | } |
99 | |
111 | |
100 | static void * |
112 | static void |
101 | e_destroy (void *w_) |
113 | e_destroy (void *w_) |
102 | { |
114 | { |
103 | struct ev_watcher *w = w_; |
115 | struct ev_watcher *w = w_; |
104 | |
116 | |
105 | SvREFCNT_dec (w->fh ); w->fh = 0; |
117 | SvREFCNT_dec (w->fh ); w->fh = 0; |
… | |
… | |
168 | } |
180 | } |
169 | |
181 | |
170 | ///////////////////////////////////////////////////////////////////////////// |
182 | ///////////////////////////////////////////////////////////////////////////// |
171 | // DNS |
183 | // DNS |
172 | |
184 | |
|
|
185 | #ifndef WIN32 |
173 | static void |
186 | static void |
174 | dns_cb (int result, char type, int count, int ttl, void *addresses, void *arg) |
187 | dns_cb (int result, char type, int count, int ttl, void *addresses, void *arg) |
175 | { |
188 | { |
176 | dSP; |
189 | dSP; |
177 | SV *cb = (SV *)arg; |
190 | SV *cb = (SV *)arg; |
… | |
… | |
216 | call_sv (get_sv ("EV::DIED", 1), G_DISCARD | G_VOID | G_EVAL | G_KEEPERR); |
229 | call_sv (get_sv ("EV::DIED", 1), G_DISCARD | G_VOID | G_EVAL | G_KEEPERR); |
217 | } |
230 | } |
218 | |
231 | |
219 | LEAVE; |
232 | LEAVE; |
220 | } |
233 | } |
|
|
234 | #endif |
221 | |
235 | |
222 | #define CHECK_REPEAT(repeat) if (repeat < 0.) \ |
236 | #define CHECK_REPEAT(repeat) if (repeat < 0.) \ |
223 | croak (# repeat " value must be >= 0"); |
237 | croak (# repeat " value must be >= 0"); |
224 | |
238 | |
225 | #define CHECK_FD(fh,fd) if ((fd) < 0) \ |
239 | #define CHECK_FD(fh,fd) if ((fd) < 0) \ |
… | |
… | |
232 | |
246 | |
233 | PROTOTYPES: ENABLE |
247 | PROTOTYPES: ENABLE |
234 | |
248 | |
235 | BOOT: |
249 | BOOT: |
236 | { |
250 | { |
237 | int i; |
|
|
238 | HV *stash = gv_stashpv ("EV", 1); |
251 | HV *stash = gv_stashpv ("EV", 1); |
239 | |
252 | |
240 | static const struct { |
253 | static const struct { |
241 | const char *name; |
254 | const char *name; |
242 | IV iv; |
255 | IV iv; |
… | |
… | |
315 | evapi.child_stop = ev_child_stop; |
328 | evapi.child_stop = ev_child_stop; |
316 | |
329 | |
317 | sv_setiv (sv, (IV)&evapi); |
330 | sv_setiv (sv, (IV)&evapi); |
318 | SvREADONLY_on (sv); |
331 | SvREADONLY_on (sv); |
319 | } |
332 | } |
320 | |
333 | #ifndef WIN32 |
321 | pthread_atfork (0, 0, ev_default_fork); |
334 | pthread_atfork (0, 0, ev_default_fork); |
|
|
335 | #endif |
322 | } |
336 | } |
323 | |
337 | |
324 | NV ev_now () |
338 | NV ev_now () |
325 | |
339 | |
326 | int ev_method () |
340 | int ev_method () |
… | |
… | |
582 | } |
596 | } |
583 | } |
597 | } |
584 | OUTPUT: |
598 | OUTPUT: |
585 | RETVAL |
599 | RETVAL |
586 | |
600 | |
587 | MODULE = EV PACKAGE = EV::Time |
|
|
588 | |
|
|
589 | MODULE = EV PACKAGE = EV::Timer PREFIX = ev_timer_ |
601 | MODULE = EV PACKAGE = EV::Timer PREFIX = ev_timer_ |
590 | |
602 | |
591 | void ev_timer_start (struct ev_timer *w) |
603 | void ev_timer_start (struct ev_timer *w) |
592 | INIT: |
604 | INIT: |
593 | CHECK_REPEAT (w->repeat); |
605 | CHECK_REPEAT (w->repeat); |
… | |
… | |
719 | rpid = 1 |
731 | rpid = 1 |
720 | CODE: |
732 | CODE: |
721 | RETVAL = ix ? w->rpid : w->rstatus; |
733 | RETVAL = ix ? w->rpid : w->rstatus; |
722 | OUTPUT: |
734 | OUTPUT: |
723 | RETVAL |
735 | RETVAL |
|
|
736 | |
|
|
737 | #ifndef WIN32 |
724 | |
738 | |
725 | MODULE = EV PACKAGE = EV::DNS PREFIX = evdns_ |
739 | MODULE = EV PACKAGE = EV::DNS PREFIX = evdns_ |
726 | |
740 | |
727 | BOOT: |
741 | BOOT: |
728 | { |
742 | { |
… | |
… | |
853 | |
867 | |
854 | #void DESTROY (struct evhttp_request *req); |
868 | #void DESTROY (struct evhttp_request *req); |
855 | |
869 | |
856 | #endif |
870 | #endif |
857 | |
871 | |
|
|
872 | #endif |
858 | |
873 | |
859 | |
874 | |
860 | |
875 | |
861 | |
876 | |
862 | |
877 | |