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

Comparing EV/EV.xs (file contents):
Revision 1.61 by root, Thu Nov 8 17:24:00 2007 UTC vs.
Revision 1.71 by root, Sat Nov 17 01:41:33 2007 UTC

9 9
10/* fix perl api breakage */ 10/* fix perl api breakage */
11#undef signal 11#undef signal
12#undef sigaction 12#undef sigaction
13 13
14#define EV_SELECT_USE_WIN32_HANDLES 0 14#define EV_SELECT_IS_WINSOCKET 0
15#ifdef _WIN32
15#define EV_SELECT_USE_FD_SET 0 16# define EV_SELECT_USE_FD_SET 0
17# define NFDBITS PERL_NFDBITS
18# define fd_mask Perl_fd_mask
19#endif
16/* due to bugs in OS X we have to use libev/ explicitly here */ 20/* due to bugs in OS X we have to use libev/ explicitly here */
17#include "libev/ev.c" 21#include "libev/ev.c"
18#include "event.c" 22#include "event.c"
19 23
20#ifndef WIN32 24#ifndef _WIN32
21#define DNS_USE_GETTIMEOFDAY_FOR_ID 1 25#define DNS_USE_GETTIMEOFDAY_FOR_ID 1
22#if !defined (WIN32) && !defined(__CYGWIN__) 26#if !defined (WIN32) && !defined(__CYGWIN__)
23# define HAVE_STRUCT_IN6_ADDR 1 27# define HAVE_STRUCT_IN6_ADDR 1
24#endif 28#endif
25#undef HAVE_STRTOK_R 29#undef HAVE_STRTOK_R
26#undef strtok_r 30#undef strtok_r
27#define strtok_r fake_strtok_r 31#define strtok_r fake_strtok_r
32#include "evdns.h"
28#include "evdns.c" 33#include "evdns.c"
29#endif 34#endif
30 35
31#ifndef WIN32 36#ifndef _WIN32
32# include <pthread.h> 37# include <pthread.h>
33#endif 38#endif
34 39
35typedef int Signal; 40typedef int Signal;
36 41
100 SvPOK_only (self); 105 SvPOK_only (self);
101 SvCUR_set (self, size); 106 SvCUR_set (self, size);
102 107
103 w = (struct ev_watcher *)SvPVX (self); 108 w = (struct ev_watcher *)SvPVX (self);
104 109
105 ev_watcher_init (w, e_cb); 110 ev_init (w, e_cb);
106 111
107 w->data = 0; 112 w->data = 0;
108 w->fh = 0; 113 w->fh = 0;
109 w->cb_sv = newSVsv (cb_sv); 114 w->cb_sv = newSVsv (cb_sv);
110 w->self = self; 115 w->self = self;
162 PUSHs (sv_self); 167 PUSHs (sv_self);
163 PUSHs (sv_events); 168 PUSHs (sv_events);
164 169
165 PUTBACK; 170 PUTBACK;
166 call_sv (w->cb_sv, G_DISCARD | G_VOID | G_EVAL); 171 call_sv (w->cb_sv, G_DISCARD | G_VOID | G_EVAL);
167 SP = PL_stack_base + mark; PUTBACK;
168 172
169 SvREFCNT_dec (sv_self); 173 SvREFCNT_dec (sv_self);
170 SvREFCNT_dec (sv_status); 174 SvREFCNT_dec (sv_status);
171 175
172 if (sv_events_cache) 176 if (sv_events_cache)
177 if (SvTRUE (ERRSV)) 181 if (SvTRUE (ERRSV))
178 { 182 {
179 PUSHMARK (SP); 183 PUSHMARK (SP);
180 PUTBACK; 184 PUTBACK;
181 call_sv (get_sv ("EV::DIED", 1), G_DISCARD | G_VOID | G_EVAL | G_KEEPERR); 185 call_sv (get_sv ("EV::DIED", 1), G_DISCARD | G_VOID | G_EVAL | G_KEEPERR);
182 SP = PL_stack_base + mark; PUTBACK;
183 } 186 }
187
188 SP = PL_stack_base + mark;
189 PUTBACK;
184} 190}
185 191
186static ev_tstamp 192static ev_tstamp
187e_periodic_cb (struct ev_periodic *w, ev_tstamp now) 193e_periodic_cb (struct ev_periodic *w, ev_tstamp now)
188{ 194{
227} 233}
228 234
229///////////////////////////////////////////////////////////////////////////// 235/////////////////////////////////////////////////////////////////////////////
230// DNS 236// DNS
231 237
232#ifndef WIN32 238#ifndef _WIN32
233static void 239static void
234dns_cb (int result, char type, int count, int ttl, void *addresses, void *arg) 240dns_cb (int result, char type, int count, int ttl, void *addresses, void *arg)
235{ 241{
236 dSP; 242 dSP;
237 SV *cb = (SV *)arg; 243 SV *cb = (SV *)arg;
315 const_iv (EV_, CHECK) 321 const_iv (EV_, CHECK)
316 const_iv (EV_, ERROR) 322 const_iv (EV_, ERROR)
317 323
318 const_iv (EV, LOOP_ONESHOT) 324 const_iv (EV, LOOP_ONESHOT)
319 const_iv (EV, LOOP_NONBLOCK) 325 const_iv (EV, LOOP_NONBLOCK)
326 const_iv (EV, UNLOOP_ONE)
327 const_iv (EV, UNLOOP_ALL)
320 328
321 const_iv (EV, METHOD_AUTO)
322 const_iv (EV, METHOD_SELECT) 329 const_iv (EV, METHOD_SELECT)
323 const_iv (EV, METHOD_POLL) 330 const_iv (EV, METHOD_POLL)
324 const_iv (EV, METHOD_EPOLL) 331 const_iv (EV, METHOD_EPOLL)
325 const_iv (EV, METHOD_KQUEUE) 332 const_iv (EV, METHOD_KQUEUE)
326 const_iv (EV, METHOD_DEVPOLL) 333 const_iv (EV, METHOD_DEVPOLL)
327 const_iv (EV, METHOD_PORT) 334 const_iv (EV, METHOD_PORT)
328 const_iv (EV, METHOD_ANY) 335 const_iv (EV, FLAG_AUTO)
336 const_iv (EV, FLAG_NOENV)
329 }; 337 };
330 338
331 for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) 339 for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; )
332 newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); 340 newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv));
333 341
375 evapi.child_stop = ev_child_stop; 383 evapi.child_stop = ev_child_stop;
376 384
377 sv_setiv (sv, (IV)&evapi); 385 sv_setiv (sv, (IV)&evapi);
378 SvREADONLY_on (sv); 386 SvREADONLY_on (sv);
379 } 387 }
380#ifndef WIN32 388#ifndef _WIN32
381 pthread_atfork (0, 0, ev_default_fork); 389 pthread_atfork (0, 0, ev_default_fork);
382#endif 390#endif
383} 391}
384 392
385NV ev_now () 393NV ev_now ()
386 394
387int ev_method () 395int ev_method ()
388 396
389NV ev_time () 397NV ev_time ()
390 398
391int ev_default_loop (int methods = EVMETHOD_AUTO) 399int ev_default_loop (int methods = EVFLAG_AUTO)
392 400
393void ev_loop (int flags = 0) 401void ev_loop (int flags = 0)
394 402
395void ev_unloop (int how = 1) 403void ev_unloop (int how = 1)
396 404
479 OUTPUT: 487 OUTPUT:
480 RETVAL 488 RETVAL
481 489
482struct ev_child *child (int pid, SV *cb) 490struct ev_child *child (int pid, SV *cb)
483 ALIAS: 491 ALIAS:
484 check_ns = 1 492 child_ns = 1
485 CODE: 493 CODE:
486 RETVAL = e_new (sizeof (struct ev_child), cb); 494 RETVAL = e_new (sizeof (struct ev_child), cb);
487 ev_child_set (RETVAL, pid); 495 ev_child_set (RETVAL, pid);
488 if (!ix) ev_child_start (RETVAL); 496 if (!ix) ev_child_start (RETVAL);
489 OUTPUT: 497 OUTPUT:
796 CODE: 804 CODE:
797 RETVAL = ix ? w->rpid : w->rstatus; 805 RETVAL = ix ? w->rpid : w->rstatus;
798 OUTPUT: 806 OUTPUT:
799 RETVAL 807 RETVAL
800 808
801#ifndef WIN32 809#ifndef _WIN32
802 810
803MODULE = EV PACKAGE = EV::DNS PREFIX = evdns_ 811MODULE = EV PACKAGE = EV::DNS PREFIX = evdns_
804 812
805BOOT: 813BOOT:
806{ 814{
877 885
878int evdns_set_option (char *option, char *val, int flags) 886int evdns_set_option (char *option, char *val, int flags)
879 887
880int evdns_resolv_conf_parse (int flags, const char *filename) 888int evdns_resolv_conf_parse (int flags, const char *filename)
881 889
882#ifdef MS_WINDOWS 890#ifdef _WIN32
883 891
884int evdns_config_windows_nameservers () 892int evdns_config_windows_nameservers ()
885 893
886#endif 894#endif
887 895

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines