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

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines