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

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines