ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/EV/EV.xs
(Generate patch)

Comparing EV/EV.xs (file contents):
Revision 1.54 by root, Tue Nov 6 12:31:20 2007 UTC vs.
Revision 1.58 by root, Wed Nov 7 13:27:56 2007 UTC

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
30
31#ifndef WIN32
32# include <pthread.h>
33#endif
21 34
22typedef int Signal; 35typedef int Signal;
23 36
24static struct EVAPI evapi; 37static struct EVAPI evapi;
25 38
96 w->self = self; 109 w->self = self;
97 110
98 return (void *)w; 111 return (void *)w;
99} 112}
100 113
101static void * 114static void
102e_destroy (void *w_) 115e_destroy (void *w_)
103{ 116{
104 struct ev_watcher *w = w_; 117 struct ev_watcher *w = (struct ev_watcher *)w_;
105 118
106 SvREFCNT_dec (w->fh ); w->fh = 0; 119 SvREFCNT_dec (w->fh ); w->fh = 0;
107 SvREFCNT_dec (w->cb_sv); w->cb_sv = 0; 120 SvREFCNT_dec (w->cb_sv); w->cb_sv = 0;
108} 121}
109 122
169} 182}
170 183
171///////////////////////////////////////////////////////////////////////////// 184/////////////////////////////////////////////////////////////////////////////
172// DNS 185// DNS
173 186
187#ifndef WIN32
174static void 188static void
175dns_cb (int result, char type, int count, int ttl, void *addresses, void *arg) 189dns_cb (int result, char type, int count, int ttl, void *addresses, void *arg)
176{ 190{
177 dSP; 191 dSP;
178 SV *cb = (SV *)arg; 192 SV *cb = (SV *)arg;
217 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);
218 } 232 }
219 233
220 LEAVE; 234 LEAVE;
221} 235}
236#endif
222 237
223#define CHECK_REPEAT(repeat) if (repeat < 0.) \ 238#define CHECK_REPEAT(repeat) if (repeat < 0.) \
224 croak (# repeat " value must be >= 0"); 239 croak (# repeat " value must be >= 0");
225 240
226#define CHECK_FD(fh,fd) if ((fd) < 0) \ 241#define CHECK_FD(fh,fd) if ((fd) < 0) \
233 248
234PROTOTYPES: ENABLE 249PROTOTYPES: ENABLE
235 250
236BOOT: 251BOOT:
237{ 252{
238 int i;
239 HV *stash = gv_stashpv ("EV", 1); 253 HV *stash = gv_stashpv ("EV", 1);
240 254
241 static const struct { 255 static const struct {
242 const char *name; 256 const char *name;
243 IV iv; 257 IV iv;
316 evapi.child_stop = ev_child_stop; 330 evapi.child_stop = ev_child_stop;
317 331
318 sv_setiv (sv, (IV)&evapi); 332 sv_setiv (sv, (IV)&evapi);
319 SvREADONLY_on (sv); 333 SvREADONLY_on (sv);
320 } 334 }
321 335#ifndef WIN32
322 pthread_atfork (0, 0, ev_default_fork); 336 pthread_atfork (0, 0, ev_default_fork);
337#endif
323} 338}
324 339
325NV ev_now () 340NV ev_now ()
326 341
327int ev_method () 342int ev_method ()
718 rpid = 1 733 rpid = 1
719 CODE: 734 CODE:
720 RETVAL = ix ? w->rpid : w->rstatus; 735 RETVAL = ix ? w->rpid : w->rstatus;
721 OUTPUT: 736 OUTPUT:
722 RETVAL 737 RETVAL
738
739#ifndef WIN32
723 740
724MODULE = EV PACKAGE = EV::DNS PREFIX = evdns_ 741MODULE = EV PACKAGE = EV::DNS PREFIX = evdns_
725 742
726BOOT: 743BOOT:
727{ 744{
852 869
853#void DESTROY (struct evhttp_request *req); 870#void DESTROY (struct evhttp_request *req);
854 871
855#endif 872#endif
856 873
874#endif
857 875
858 876
859 877
860 878
861 879

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines