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

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines