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

Comparing EV/EV.xs (file contents):
Revision 1.44 by root, Fri Nov 2 23:22:17 2007 UTC vs.
Revision 1.49 by root, Sun Nov 4 16:43:53 2007 UTC

8#include "EV/EVAPI.h" 8#include "EV/EVAPI.h"
9 9
10#include "libev/ev.c" 10#include "libev/ev.c"
11#include "libev/event.h" 11#include "libev/event.h"
12#include "libev/event.c" 12#include "libev/event.c"
13#define DNS_USE_GETTIMEOFDAY_FOR_ID 1
14#define HAVE_STRUCT_IN6_ADDR 1
15#undef HAVE_STRTOK_R
16#undef strtok_r
17#define strtok_r fake_strtok_r
13#include "libev/evdns.c" 18#include "libev/evdns.c"
14 19
15typedef int Signal; 20typedef int Signal;
16 21
17static struct EVAPI evapi; 22static struct EVAPI evapi;
137 142
138 PUSHMARK (SP); 143 PUSHMARK (SP);
139 EXTEND (SP, 2); 144 EXTEND (SP, 2);
140 PUSHs (sv_self); 145 PUSHs (sv_self);
141 PUSHs (sv_events); 146 PUSHs (sv_events);
142
143 if (revents & EV_CHILD)
144 XPUSHs (sv_status = newSViv (((struct ev_child *)w)->status));
145 147
146 PUTBACK; 148 PUTBACK;
147 call_sv (w->cb_sv, G_DISCARD | G_VOID | G_EVAL); 149 call_sv (w->cb_sv, G_DISCARD | G_VOID | G_EVAL);
148 SP = PL_stack_base + mark; PUTBACK; 150 SP = PL_stack_base + mark; PUTBACK;
149 151
285 /* the poor man's shared library emulator */ 287 /* the poor man's shared library emulator */
286 evapi.ver = EV_API_VERSION; 288 evapi.ver = EV_API_VERSION;
287 evapi.rev = EV_API_REVISION; 289 evapi.rev = EV_API_REVISION;
288 evapi.sv_fileno = sv_fileno; 290 evapi.sv_fileno = sv_fileno;
289 evapi.sv_signum = sv_signum; 291 evapi.sv_signum = sv_signum;
290 evapi.now = &ev_now; 292 evapi.now = ev_now;
291 evapi.method = &ev_method; 293 evapi.method = ev_method;
292 evapi.loop_done = &ev_loop_done; 294 evapi.unloop = ev_unloop;
293 evapi.time = ev_time; 295 evapi.time = ev_time;
294 evapi.loop = ev_loop; 296 evapi.loop = ev_loop;
295 evapi.once = ev_once; 297 evapi.once = ev_once;
296 evapi.io_start = ev_io_start; 298 evapi.io_start = ev_io_start;
297 evapi.io_stop = ev_io_stop; 299 evapi.io_stop = ev_io_stop;
313 315
314 sv_setiv (sv, (IV)&evapi); 316 sv_setiv (sv, (IV)&evapi);
315 SvREADONLY_on (sv); 317 SvREADONLY_on (sv);
316 } 318 }
317 319
318 pthread_atfork (ev_fork_prepare, ev_fork_parent, ev_fork_child); 320 pthread_atfork (0, 0, ev_default_fork);
319} 321}
320 322
321NV ev_now () 323NV ev_now ()
322 CODE:
323 RETVAL = ev_now;
324 OUTPUT:
325 RETVAL
326 324
327int ev_method () 325int ev_method ()
328 CODE:
329 RETVAL = ev_method;
330 OUTPUT:
331 RETVAL
332 326
333NV ev_time () 327NV ev_time ()
334 328
335int ev_init (int methods = EVMETHOD_AUTO) 329int ev_init (int methods = EVMETHOD_AUTO)
336 330
337void ev_loop (int flags = 0) 331void ev_loop (int flags = 0)
338 332
339void ev_loop_done (int value = 1) 333void ev_unloop (int how = 1)
340 CODE:
341 ev_loop_done = value;
342 334
343struct ev_io *io (SV *fh, int events, SV *cb) 335struct ev_io *io (SV *fh, int events, SV *cb)
344 ALIAS: 336 ALIAS:
345 io_ns = 1 337 io_ns = 1
346 CODE: 338 CODE:
422 414
423struct ev_child *child (int pid, SV *cb) 415struct ev_child *child (int pid, SV *cb)
424 ALIAS: 416 ALIAS:
425 check_ns = 1 417 check_ns = 1
426 CODE: 418 CODE:
427 RETVAL = e_new (sizeof (struct ev_check), cb); 419 RETVAL = e_new (sizeof (struct ev_child), cb);
428 ev_child_set (RETVAL, pid); 420 ev_child_set (RETVAL, pid);
429 if (!ix) ev_child_start (RETVAL); 421 if (!ix) ev_child_start (RETVAL);
430 OUTPUT: 422 OUTPUT:
431 RETVAL 423 RETVAL
432 424
719} 711}
720 OUTPUT: 712 OUTPUT:
721 RETVAL 713 RETVAL
722 714
723 715
724int status (struct ev_child *w) 716int rstatus (struct ev_child *w)
717 ALIAS:
718 rpid = 1
725 CODE: 719 CODE:
726 RETVAL = w->status; 720 RETVAL = ix ? w->rpid : w->rstatus;
727 OUTPUT: 721 OUTPUT:
728 RETVAL 722 RETVAL
729 723
730MODULE = EV PACKAGE = EV::DNS PREFIX = evdns_ 724MODULE = EV PACKAGE = EV::DNS PREFIX = evdns_
731 725

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines