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

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines