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.56 by root, Tue Nov 6 16:09:37 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/* 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
19typedef int Signal; 33typedef int Signal;
20 34
21static struct EVAPI evapi; 35static 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
98static void * 112static void
99e_destroy (void *w_) 113e_destroy (void *w_)
100{ 114{
101 struct ev_watcher *w = w_; 115 struct ev_watcher *w = w_;
102 116
103 SvREFCNT_dec (w->fh ); w->fh = 0; 117 SvREFCNT_dec (w->fh ); w->fh = 0;
166} 180}
167 181
168///////////////////////////////////////////////////////////////////////////// 182/////////////////////////////////////////////////////////////////////////////
169// DNS 183// DNS
170 184
185#ifndef WIN32
171static void 186static void
172dns_cb (int result, char type, int count, int ttl, void *addresses, void *arg) 187dns_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
231PROTOTYPES: ENABLE 247PROTOTYPES: ENABLE
232 248
233BOOT: 249BOOT:
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
322NV ev_now () 338NV ev_now ()
323 339
324int ev_method () 340int ev_method ()
580 } 596 }
581} 597}
582 OUTPUT: 598 OUTPUT:
583 RETVAL 599 RETVAL
584 600
585MODULE = EV PACKAGE = EV::Time
586
587MODULE = EV PACKAGE = EV::Timer PREFIX = ev_timer_ 601MODULE = EV PACKAGE = EV::Timer PREFIX = ev_timer_
588 602
589void ev_timer_start (struct ev_timer *w) 603void 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
723MODULE = EV PACKAGE = EV::DNS PREFIX = evdns_ 739MODULE = EV PACKAGE = EV::DNS PREFIX = evdns_
724 740
725BOOT: 741BOOT:
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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines