… | |
… | |
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 | #define EV_SELECT_USE_WIN32_HANDLES 0 |
|
|
15 | #define EV_SELECT_USE_FD_SET 0 |
10 | /* due to bugs in OS X we have to use libev/ explicitly here */ |
16 | /* due to bugs in OS X we have to use libev/ explicitly here */ |
11 | #include "libev/ev.c" |
17 | #include "libev/ev.c" |
12 | #include "event.c" |
18 | #include "event.c" |
|
|
19 | |
|
|
20 | #ifndef WIN32 |
13 | #define DNS_USE_GETTIMEOFDAY_FOR_ID 1 |
21 | #define DNS_USE_GETTIMEOFDAY_FOR_ID 1 |
14 | #if !defined (WIN32) && !defined(__CYGWIN__) |
22 | #if !defined (WIN32) && !defined(__CYGWIN__) |
15 | # define HAVE_STRUCT_IN6_ADDR 1 |
23 | # define HAVE_STRUCT_IN6_ADDR 1 |
16 | #endif |
24 | #endif |
17 | #undef HAVE_STRTOK_R |
25 | #undef HAVE_STRTOK_R |
18 | #undef strtok_r |
26 | #undef strtok_r |
19 | #define strtok_r fake_strtok_r |
27 | #define strtok_r fake_strtok_r |
20 | #include "evdns.c" |
28 | #include "evdns.c" |
|
|
29 | #endif |
21 | |
30 | |
22 | #ifndef WIN32 |
31 | #ifndef WIN32 |
23 | # include <pthread.h> |
32 | # include <pthread.h> |
24 | #endif |
33 | #endif |
25 | |
34 | |
… | |
… | |
100 | w->self = self; |
109 | w->self = self; |
101 | |
110 | |
102 | return (void *)w; |
111 | return (void *)w; |
103 | } |
112 | } |
104 | |
113 | |
105 | static void * |
114 | static void |
106 | e_destroy (void *w_) |
115 | e_destroy (void *w_) |
107 | { |
116 | { |
108 | struct ev_watcher *w = w_; |
117 | struct ev_watcher *w = (struct ev_watcher *)w_; |
109 | |
118 | |
110 | SvREFCNT_dec (w->fh ); w->fh = 0; |
119 | SvREFCNT_dec (w->fh ); w->fh = 0; |
111 | SvREFCNT_dec (w->cb_sv); w->cb_sv = 0; |
120 | SvREFCNT_dec (w->cb_sv); w->cb_sv = 0; |
112 | } |
121 | } |
113 | |
122 | |
… | |
… | |
173 | } |
182 | } |
174 | |
183 | |
175 | ///////////////////////////////////////////////////////////////////////////// |
184 | ///////////////////////////////////////////////////////////////////////////// |
176 | // DNS |
185 | // DNS |
177 | |
186 | |
|
|
187 | #ifndef WIN32 |
178 | static void |
188 | static void |
179 | dns_cb (int result, char type, int count, int ttl, void *addresses, void *arg) |
189 | dns_cb (int result, char type, int count, int ttl, void *addresses, void *arg) |
180 | { |
190 | { |
181 | dSP; |
191 | dSP; |
182 | SV *cb = (SV *)arg; |
192 | SV *cb = (SV *)arg; |
… | |
… | |
221 | call_sv (get_sv ("EV::DIED", 1), G_DISCARD | G_VOID | G_EVAL | G_KEEPERR); |
231 | call_sv (get_sv ("EV::DIED", 1), G_DISCARD | G_VOID | G_EVAL | G_KEEPERR); |
222 | } |
232 | } |
223 | |
233 | |
224 | LEAVE; |
234 | LEAVE; |
225 | } |
235 | } |
|
|
236 | #endif |
226 | |
237 | |
227 | #define CHECK_REPEAT(repeat) if (repeat < 0.) \ |
238 | #define CHECK_REPEAT(repeat) if (repeat < 0.) \ |
228 | croak (# repeat " value must be >= 0"); |
239 | croak (# repeat " value must be >= 0"); |
229 | |
240 | |
230 | #define CHECK_FD(fh,fd) if ((fd) < 0) \ |
241 | #define CHECK_FD(fh,fd) if ((fd) < 0) \ |
… | |
… | |
237 | |
248 | |
238 | PROTOTYPES: ENABLE |
249 | PROTOTYPES: ENABLE |
239 | |
250 | |
240 | BOOT: |
251 | BOOT: |
241 | { |
252 | { |
242 | int i; |
|
|
243 | HV *stash = gv_stashpv ("EV", 1); |
253 | HV *stash = gv_stashpv ("EV", 1); |
244 | |
254 | |
245 | static const struct { |
255 | static const struct { |
246 | const char *name; |
256 | const char *name; |
247 | IV iv; |
257 | IV iv; |
… | |
… | |
320 | evapi.child_stop = ev_child_stop; |
330 | evapi.child_stop = ev_child_stop; |
321 | |
331 | |
322 | sv_setiv (sv, (IV)&evapi); |
332 | sv_setiv (sv, (IV)&evapi); |
323 | SvREADONLY_on (sv); |
333 | SvREADONLY_on (sv); |
324 | } |
334 | } |
325 | |
|
|
326 | #ifndef WIN32 |
335 | #ifndef WIN32 |
327 | pthread_atfork (0, 0, ev_default_fork); |
336 | pthread_atfork (0, 0, ev_default_fork); |
328 | #endif |
337 | #endif |
329 | } |
338 | } |
330 | |
339 | |
331 | NV ev_now () |
340 | NV ev_now () |
332 | |
341 | |
333 | int ev_method () |
342 | int ev_method () |
… | |
… | |
724 | rpid = 1 |
733 | rpid = 1 |
725 | CODE: |
734 | CODE: |
726 | RETVAL = ix ? w->rpid : w->rstatus; |
735 | RETVAL = ix ? w->rpid : w->rstatus; |
727 | OUTPUT: |
736 | OUTPUT: |
728 | RETVAL |
737 | RETVAL |
|
|
738 | |
|
|
739 | #ifndef WIN32 |
729 | |
740 | |
730 | MODULE = EV PACKAGE = EV::DNS PREFIX = evdns_ |
741 | MODULE = EV PACKAGE = EV::DNS PREFIX = evdns_ |
731 | |
742 | |
732 | BOOT: |
743 | BOOT: |
733 | { |
744 | { |
… | |
… | |
858 | |
869 | |
859 | #void DESTROY (struct evhttp_request *req); |
870 | #void DESTROY (struct evhttp_request *req); |
860 | |
871 | |
861 | #endif |
872 | #endif |
862 | |
873 | |
|
|
874 | #endif |
863 | |
875 | |
864 | |
876 | |
865 | |
877 | |
866 | |
878 | |
867 | |
879 | |