… | |
… | |
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 "ev.c" |
15 | #include "libev/ev.c" |
11 | #include "event.c" |
16 | #include "event.c" |
|
|
17 | |
|
|
18 | #ifndef WIN32 |
12 | #define DNS_USE_GETTIMEOFDAY_FOR_ID 1 |
19 | #define DNS_USE_GETTIMEOFDAY_FOR_ID 1 |
|
|
20 | #if !defined (WIN32) && !defined(__CYGWIN__) |
13 | #define HAVE_STRUCT_IN6_ADDR 1 |
21 | # define HAVE_STRUCT_IN6_ADDR 1 |
|
|
22 | #endif |
14 | #undef HAVE_STRTOK_R |
23 | #undef HAVE_STRTOK_R |
15 | #undef strtok_r |
24 | #undef strtok_r |
16 | #define strtok_r fake_strtok_r |
25 | #define strtok_r fake_strtok_r |
17 | #include "evdns.c" |
26 | #include "evdns.c" |
|
|
27 | #endif |
|
|
28 | |
|
|
29 | #ifndef WIN32 |
|
|
30 | # include <pthread.h> |
|
|
31 | #endif |
18 | |
32 | |
19 | typedef int Signal; |
33 | typedef int Signal; |
20 | |
34 | |
21 | static struct EVAPI evapi; |
35 | static struct EVAPI evapi; |
22 | |
36 | |
… | |
… | |
93 | w->self = self; |
107 | w->self = self; |
94 | |
108 | |
95 | return (void *)w; |
109 | return (void *)w; |
96 | } |
110 | } |
97 | |
111 | |
98 | static void * |
112 | static void |
99 | e_destroy (void *w_) |
113 | e_destroy (void *w_) |
100 | { |
114 | { |
101 | struct ev_watcher *w = w_; |
115 | struct ev_watcher *w = (struct ev_watcher *)w_; |
102 | |
116 | |
103 | SvREFCNT_dec (w->fh ); w->fh = 0; |
117 | SvREFCNT_dec (w->fh ); w->fh = 0; |
104 | SvREFCNT_dec (w->cb_sv); w->cb_sv = 0; |
118 | SvREFCNT_dec (w->cb_sv); w->cb_sv = 0; |
105 | } |
119 | } |
106 | |
120 | |
… | |
… | |
166 | } |
180 | } |
167 | |
181 | |
168 | ///////////////////////////////////////////////////////////////////////////// |
182 | ///////////////////////////////////////////////////////////////////////////// |
169 | // DNS |
183 | // DNS |
170 | |
184 | |
|
|
185 | #ifndef WIN32 |
171 | static void |
186 | static void |
172 | 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) |
173 | { |
188 | { |
174 | dSP; |
189 | dSP; |
175 | SV *cb = (SV *)arg; |
190 | SV *cb = (SV *)arg; |
… | |
… | |
214 | 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); |
215 | } |
230 | } |
216 | |
231 | |
217 | LEAVE; |
232 | LEAVE; |
218 | } |
233 | } |
|
|
234 | #endif |
219 | |
235 | |
220 | #define CHECK_REPEAT(repeat) if (repeat < 0.) \ |
236 | #define CHECK_REPEAT(repeat) if (repeat < 0.) \ |
221 | croak (# repeat " value must be >= 0"); |
237 | croak (# repeat " value must be >= 0"); |
222 | |
238 | |
223 | #define CHECK_FD(fh,fd) if ((fd) < 0) \ |
239 | #define CHECK_FD(fh,fd) if ((fd) < 0) \ |
… | |
… | |
230 | |
246 | |
231 | PROTOTYPES: ENABLE |
247 | PROTOTYPES: ENABLE |
232 | |
248 | |
233 | BOOT: |
249 | BOOT: |
234 | { |
250 | { |
235 | int i; |
|
|
236 | HV *stash = gv_stashpv ("EV", 1); |
251 | HV *stash = gv_stashpv ("EV", 1); |
237 | |
252 | |
238 | static const struct { |
253 | static const struct { |
239 | const char *name; |
254 | const char *name; |
240 | IV iv; |
255 | IV iv; |
… | |
… | |
313 | evapi.child_stop = ev_child_stop; |
328 | evapi.child_stop = ev_child_stop; |
314 | |
329 | |
315 | sv_setiv (sv, (IV)&evapi); |
330 | sv_setiv (sv, (IV)&evapi); |
316 | SvREADONLY_on (sv); |
331 | SvREADONLY_on (sv); |
317 | } |
332 | } |
318 | |
333 | #ifndef WIN32 |
319 | pthread_atfork (0, 0, ev_default_fork); |
334 | pthread_atfork (0, 0, ev_default_fork); |
|
|
335 | #endif |
320 | } |
336 | } |
321 | |
337 | |
322 | NV ev_now () |
338 | NV ev_now () |
323 | |
339 | |
324 | int ev_method () |
340 | int ev_method () |
… | |
… | |
580 | } |
596 | } |
581 | } |
597 | } |
582 | OUTPUT: |
598 | OUTPUT: |
583 | RETVAL |
599 | RETVAL |
584 | |
600 | |
585 | MODULE = EV PACKAGE = EV::Time |
|
|
586 | |
|
|
587 | MODULE = EV PACKAGE = EV::Timer PREFIX = ev_timer_ |
601 | MODULE = EV PACKAGE = EV::Timer PREFIX = ev_timer_ |
588 | |
602 | |
589 | void ev_timer_start (struct ev_timer *w) |
603 | void ev_timer_start (struct ev_timer *w) |
590 | INIT: |
604 | INIT: |
591 | CHECK_REPEAT (w->repeat); |
605 | CHECK_REPEAT (w->repeat); |
… | |
… | |
717 | rpid = 1 |
731 | rpid = 1 |
718 | CODE: |
732 | CODE: |
719 | RETVAL = ix ? w->rpid : w->rstatus; |
733 | RETVAL = ix ? w->rpid : w->rstatus; |
720 | OUTPUT: |
734 | OUTPUT: |
721 | RETVAL |
735 | RETVAL |
|
|
736 | |
|
|
737 | #ifndef WIN32 |
722 | |
738 | |
723 | MODULE = EV PACKAGE = EV::DNS PREFIX = evdns_ |
739 | MODULE = EV PACKAGE = EV::DNS PREFIX = evdns_ |
724 | |
740 | |
725 | BOOT: |
741 | BOOT: |
726 | { |
742 | { |
… | |
… | |
851 | |
867 | |
852 | #void DESTROY (struct evhttp_request *req); |
868 | #void DESTROY (struct evhttp_request *req); |
853 | |
869 | |
854 | #endif |
870 | #endif |
855 | |
871 | |
|
|
872 | #endif |
856 | |
873 | |
857 | |
874 | |
858 | |
875 | |
859 | |
876 | |
860 | |
877 | |