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

Comparing EV/EV.xs (file contents):
Revision 1.29 by root, Thu Nov 1 06:48:49 2007 UTC vs.
Revision 1.53 by root, Mon Nov 5 21:43:17 2007 UTC

2#include "perl.h" 2#include "perl.h"
3#include "XSUB.h" 3#include "XSUB.h"
4 4
5/*#include <netinet/in.h>*/ 5/*#include <netinet/in.h>*/
6 6
7#define TIMEOUT_NONE HUGE_VAL
8#define HAVE_EPOLL 1
9
10#define EV_PROTOTYPES 1 7#define EV_PROTOTYPES 1
11#include "EV/EVAPI.h" 8#include "EV/EVAPI.h"
12 9
10/* due to bugs in OS X we have to use libev/ explicitly here */
13#include "libev/ev.c" 11#include "libev/ev.c"
12#include "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
18#include "evdns.c"
14 19
15typedef int Signal; 20typedef int Signal;
16 21
17static struct EVAPI evapi; 22static struct EVAPI evapi;
18 23
19static HV 24static HV
20 *stash_watcher, 25 *stash_watcher,
21 *stash_io, 26 *stash_io,
22 *stash_time,
23 *stash_timer, 27 *stash_timer,
24 *stash_periodic, 28 *stash_periodic,
25 *stash_signal, 29 *stash_signal,
26 *stash_idle, 30 *stash_idle,
27 *stash_prepare, 31 *stash_prepare,
28 *stash_check, 32 *stash_check,
29 *stash_child; 33 *stash_child;
30 34
35#ifndef SIG_SIZE
36/* kudos to Slaven Rezic for the idea */
37static char sig_size [] = { SIG_NUM };
38# define SIG_SIZE (sizeof (sig_size) + 1)
39#endif
40
31static int 41static int
32sv_signum (SV *sig) 42sv_signum (SV *sig)
33{ 43{
34 int signum; 44 int signum;
35 45
36 if (SvIV (sig) > 0) 46 SvGETMAGIC (sig);
37 return SvIV (sig);
38 47
39 for (signum = 1; signum < SIG_SIZE; ++signum) 48 for (signum = 1; signum < SIG_SIZE; ++signum)
40 if (strEQ (SvPV_nolen (sig), PL_sig_name [signum])) 49 if (strEQ (SvPV_nolen (sig), PL_sig_name [signum]))
41 return signum; 50 return signum;
42 51
52 if (SvIV (sig) > 0)
53 return SvIV (sig);
54
43 return -1; 55 return -1;
44} 56}
45 57
46///////////////////////////////////////////////////////////////////////////// 58/////////////////////////////////////////////////////////////////////////////
47// Event 59// Event
57 fh = SvRV (fh); 69 fh = SvRV (fh);
58 70
59 if (SvTYPE (fh) == SVt_PVGV) 71 if (SvTYPE (fh) == SVt_PVGV)
60 return PerlIO_fileno (IoIFP (sv_2io (fh))); 72 return PerlIO_fileno (IoIFP (sv_2io (fh)));
61 73
62 if (SvIOK (fh)) 74 if ((SvIV (fh) >= 0) && (SvIV (fh) < 0x7ffffff))
63 return SvIV (fh); 75 return SvIV (fh);
64 76
65 return -1; 77 return -1;
66} 78}
67 79
80 w->fh = 0; 92 w->fh = 0;
81 w->cb_sv = newSVsv (cb_sv); 93 w->cb_sv = newSVsv (cb_sv);
82 w->self = self; 94 w->self = self;
83 95
84 return (void *)w; 96 return (void *)w;
97}
98
99static void *
100e_destroy (void *w_)
101{
102 struct ev_watcher *w = w_;
103
104 SvREFCNT_dec (w->fh ); w->fh = 0;
105 SvREFCNT_dec (w->cb_sv); w->cb_sv = 0;
85} 106}
86 107
87static SV * 108static SV *
88e_bless (struct ev_watcher *w, HV *stash) 109e_bless (struct ev_watcher *w, HV *stash)
89{ 110{
122 PUSHMARK (SP); 143 PUSHMARK (SP);
123 EXTEND (SP, 2); 144 EXTEND (SP, 2);
124 PUSHs (sv_self); 145 PUSHs (sv_self);
125 PUSHs (sv_events); 146 PUSHs (sv_events);
126 147
127 if (revents & EV_CHILD)
128 XPUSHs (sv_status = newSViv (((struct ev_child *)w)->status));
129
130 PUTBACK; 148 PUTBACK;
131 call_sv (w->cb_sv, G_DISCARD | G_VOID | G_EVAL); 149 call_sv (w->cb_sv, G_DISCARD | G_VOID | G_EVAL);
132 SP = PL_stack_base + mark; PUTBACK; 150 SP = PL_stack_base + mark; PUTBACK;
133 151
134 SvREFCNT_dec (sv_self); 152 SvREFCNT_dec (sv_self);
146 call_sv (get_sv ("EV::DIED", 1), G_DISCARD | G_VOID | G_EVAL | G_KEEPERR); 164 call_sv (get_sv ("EV::DIED", 1), G_DISCARD | G_VOID | G_EVAL | G_KEEPERR);
147 SP = PL_stack_base + mark; PUTBACK; 165 SP = PL_stack_base + mark; PUTBACK;
148 } 166 }
149} 167}
150 168
151#if 0
152///////////////////////////////////////////////////////////////////////////// 169/////////////////////////////////////////////////////////////////////////////
153// DNS 170// DNS
154 171
155static void 172static void
156dns_cb (int result, char type, int count, int ttl, void *addresses, void *arg) 173dns_cb (int result, char type, int count, int ttl, void *addresses, void *arg)
198 call_sv (get_sv ("EV::DIED", 1), G_DISCARD | G_VOID | G_EVAL | G_KEEPERR); 215 call_sv (get_sv ("EV::DIED", 1), G_DISCARD | G_VOID | G_EVAL | G_KEEPERR);
199 } 216 }
200 217
201 LEAVE; 218 LEAVE;
202} 219}
203#endif
204 220
205#define CHECK_REPEAT(repeat) if (repeat < 0.) \ 221#define CHECK_REPEAT(repeat) if (repeat < 0.) \
206 croak (# repeat " value must be >= 0"); 222 croak (# repeat " value must be >= 0");
223
224#define CHECK_FD(fh,fd) if ((fd) < 0) \
225 croak ("illegal file descriptor or filehandle (either no attached file descriptor or illegal value): %s", SvPV_nolen (fh));
207 226
208///////////////////////////////////////////////////////////////////////////// 227/////////////////////////////////////////////////////////////////////////////
209// XS interface functions 228// XS interface functions
210 229
211MODULE = EV PACKAGE = EV PREFIX = ev_ 230MODULE = EV PACKAGE = EV PREFIX = ev_
220 static const struct { 239 static const struct {
221 const char *name; 240 const char *name;
222 IV iv; 241 IV iv;
223 } *civ, const_iv[] = { 242 } *civ, const_iv[] = {
224# define const_iv(pfx, name) { # name, (IV) pfx ## name }, 243# define const_iv(pfx, name) { # name, (IV) pfx ## name },
244 const_iv (EV_, MINPRI)
245 const_iv (EV_, MAXPRI)
246
225 const_iv (EV_, UNDEF) 247 const_iv (EV_, UNDEF)
226 const_iv (EV_, NONE) 248 const_iv (EV_, NONE)
227 const_iv (EV_, TIMEOUT) 249 const_iv (EV_, TIMEOUT)
228 const_iv (EV_, READ) 250 const_iv (EV_, READ)
229 const_iv (EV_, WRITE) 251 const_iv (EV_, WRITE)
233 const_iv (EV_, ERROR) 255 const_iv (EV_, ERROR)
234 256
235 const_iv (EV, LOOP_ONESHOT) 257 const_iv (EV, LOOP_ONESHOT)
236 const_iv (EV, LOOP_NONBLOCK) 258 const_iv (EV, LOOP_NONBLOCK)
237 259
238 const_iv (EV, METHOD_NONE) 260 const_iv (EV, METHOD_AUTO)
239 const_iv (EV, METHOD_SELECT) 261 const_iv (EV, METHOD_SELECT)
262 const_iv (EV, METHOD_POLL)
240 const_iv (EV, METHOD_EPOLL) 263 const_iv (EV, METHOD_EPOLL)
264 const_iv (EV, METHOD_KQUEUE)
265 const_iv (EV, METHOD_DEVPOLL)
266 const_iv (EV, METHOD_PORT)
267 const_iv (EV, METHOD_ANY)
241 }; 268 };
242 269
243 for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) 270 for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; )
244 newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); 271 newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv));
245 272
246 stash_watcher = gv_stashpv ("EV::Watcher" , 1); 273 stash_watcher = gv_stashpv ("EV::Watcher" , 1);
247 stash_io = gv_stashpv ("EV::Io" , 1); 274 stash_io = gv_stashpv ("EV::Io" , 1);
248 stash_time = gv_stashpv ("EV::Time" , 1);
249 stash_timer = gv_stashpv ("EV::Timer" , 1); 275 stash_timer = gv_stashpv ("EV::Timer" , 1);
250 stash_periodic = gv_stashpv ("EV::Periodic", 1); 276 stash_periodic = gv_stashpv ("EV::Periodic", 1);
251 stash_signal = gv_stashpv ("EV::Signal" , 1); 277 stash_signal = gv_stashpv ("EV::Signal" , 1);
252 stash_idle = gv_stashpv ("EV::Idle" , 1); 278 stash_idle = gv_stashpv ("EV::Idle" , 1);
253 stash_prepare = gv_stashpv ("EV::Prepare" , 1); 279 stash_prepare = gv_stashpv ("EV::Prepare" , 1);
261 /* the poor man's shared library emulator */ 287 /* the poor man's shared library emulator */
262 evapi.ver = EV_API_VERSION; 288 evapi.ver = EV_API_VERSION;
263 evapi.rev = EV_API_REVISION; 289 evapi.rev = EV_API_REVISION;
264 evapi.sv_fileno = sv_fileno; 290 evapi.sv_fileno = sv_fileno;
265 evapi.sv_signum = sv_signum; 291 evapi.sv_signum = sv_signum;
266 evapi.now = &ev_now; 292 evapi.now = ev_now;
267 evapi.method = &ev_method; 293 evapi.method = ev_method;
268 evapi.loop_done = &ev_loop_done; 294 evapi.unloop = ev_unloop;
269 evapi.time = ev_time; 295 evapi.time = ev_time;
270 evapi.loop = ev_loop; 296 evapi.loop = ev_loop;
271 evapi.once = ev_once; 297 evapi.once = ev_once;
272 evapi.io_start = ev_io_start; 298 evapi.io_start = ev_io_start;
273 evapi.io_stop = ev_io_stop; 299 evapi.io_stop = ev_io_stop;
288 evapi.child_stop = ev_child_stop; 314 evapi.child_stop = ev_child_stop;
289 315
290 sv_setiv (sv, (IV)&evapi); 316 sv_setiv (sv, (IV)&evapi);
291 SvREADONLY_on (sv); 317 SvREADONLY_on (sv);
292 } 318 }
319
320 pthread_atfork (0, 0, ev_default_fork);
293} 321}
294 322
295NV ev_now () 323NV ev_now ()
296 CODE:
297 RETVAL = ev_now;
298 OUTPUT:
299 RETVAL
300 324
301int ev_method () 325int ev_method ()
302 CODE:
303 RETVAL = ev_method;
304 OUTPUT:
305 RETVAL
306 326
307NV ev_time () 327NV ev_time ()
308 328
309void ev_init (int flags = 0) 329int ev_default_loop (int methods = EVMETHOD_AUTO)
310 330
311void ev_loop (int flags = 0) 331void ev_loop (int flags = 0)
312 332
313void ev_loop_done (int value = 1) 333void ev_unloop (int how = 1)
314 CODE:
315 ev_loop_done = value;
316 334
317struct ev_io *io (SV *fh, int events, SV *cb) 335struct ev_io *io (SV *fh, int events, SV *cb)
318 ALIAS: 336 ALIAS:
319 io_ns = 1 337 io_ns = 1
320 CODE: 338 CODE:
339{
340 int fd = sv_fileno (fh);
341 CHECK_FD (fh, fd);
342
321 RETVAL = e_new (sizeof (struct ev_io), cb); 343 RETVAL = e_new (sizeof (struct ev_io), cb);
322 RETVAL->fh = newSVsv (fh); 344 RETVAL->fh = newSVsv (fh);
323 ev_io_set (RETVAL, sv_fileno (RETVAL->fh), events); 345 ev_io_set (RETVAL, fd, events);
324 if (!ix) ev_io_start (RETVAL); 346 if (!ix) ev_io_start (RETVAL);
347}
325 OUTPUT: 348 OUTPUT:
326 RETVAL 349 RETVAL
327 350
328struct ev_timer *timer (NV after, NV repeat, SV *cb) 351struct ev_timer *timer (NV after, NV repeat, SV *cb)
329 ALIAS: 352 ALIAS:
391 414
392struct ev_child *child (int pid, SV *cb) 415struct ev_child *child (int pid, SV *cb)
393 ALIAS: 416 ALIAS:
394 check_ns = 1 417 check_ns = 1
395 CODE: 418 CODE:
396 RETVAL = e_new (sizeof (struct ev_check), cb); 419 RETVAL = e_new (sizeof (struct ev_child), cb);
397 ev_child_set (RETVAL, pid); 420 ev_child_set (RETVAL, pid);
398 if (!ix) ev_child_start (RETVAL); 421 if (!ix) ev_child_start (RETVAL);
399 OUTPUT: 422 OUTPUT:
400 RETVAL 423 RETVAL
401 424
419 442
420void trigger (struct ev_watcher *w, int revents = EV_NONE) 443void trigger (struct ev_watcher *w, int revents = EV_NONE)
421 CODE: 444 CODE:
422 w->cb (w, revents); 445 w->cb (w, revents);
423 446
424MODULE = EV PACKAGE = EV::Io PREFIX = ev_io_ 447int priority (struct ev_watcher *w, int new_priority = 0)
425
426void ev_io_start (struct ev_io *w)
427
428void ev_io_stop (struct ev_io *w)
429
430void DESTROY (struct ev_io *w)
431 CODE: 448 CODE:
432 ev_io_stop (w);
433
434void set (struct ev_io *w, SV *fh, int events)
435 CODE:
436{ 449{
437 int active = w->active; 450 RETVAL = w->priority;
438 if (active) ev_io_stop (w);
439
440 sv_setsv (w->fh, fh);
441 ev_io_set (w, sv_fileno (w->fh), events);
442
443 if (active) ev_io_start (w);
444}
445
446SV *fh (struct ev_io *w, SV *new_fh = 0)
447 CODE:
448{
449 RETVAL = newSVsv (w->fh);
450 451
451 if (items > 1) 452 if (items > 1)
452 { 453 {
453 int active = w->active; 454 int active = ev_is_active (w);
455
456 if (new_priority < EV_MINPRI || new_priority > EV_MAXPRI)
457 croak ("watcher priority out of range, value must be between %d and %d, inclusive", EV_MINPRI, EV_MAXPRI);
458
459 if (active)
460 {
461 /* grrr. */
462 PUSHMARK (SP);
463 XPUSHs (ST (0));
464 call_method ("stop", G_DISCARD | G_VOID);
465 }
466
467 ev_set_priority (w, new_priority);
468
469 if (active)
470 {
471 PUSHMARK (SP);
472 XPUSHs (ST (0));
473 call_method ("start", G_DISCARD | G_VOID);
474 }
475 }
476}
477 OUTPUT:
478 RETVAL
479
480MODULE = EV PACKAGE = EV::Io PREFIX = ev_io_
481
482void ev_io_start (struct ev_io *w)
483
484void ev_io_stop (struct ev_io *w)
485
486void DESTROY (struct ev_io *w)
487 CODE:
488 ev_io_stop (w);
489 e_destroy (w);
490
491void set (struct ev_io *w, SV *fh, int events)
492 CODE:
493{
494 int active = ev_is_active (w);
495 int fd = sv_fileno (fh);
496 CHECK_FD (fh, fd);
497
498 if (active) ev_io_stop (w);
499
500 sv_setsv (w->fh, fh);
501 ev_io_set (w, fd, events);
502
503 if (active) ev_io_start (w);
504}
505
506SV *fh (struct ev_io *w, SV *new_fh = 0)
507 CODE:
508{
509 RETVAL = newSVsv (w->fh);
510
511 if (items > 1)
512 {
513 int active = ev_is_active (w);
454 if (active) ev_io_stop (w); 514 if (active) ev_io_stop (w);
455 515
456 sv_setsv (w->fh, new_fh); 516 sv_setsv (w->fh, new_fh);
457 ev_io_set (w, sv_fileno (w->fh), w->events); 517 ev_io_set (w, sv_fileno (w->fh), w->events);
458 518
460 } 520 }
461} 521}
462 OUTPUT: 522 OUTPUT:
463 RETVAL 523 RETVAL
464 524
465short events (struct ev_io *w, short new_events = EV_UNDEF) 525int events (struct ev_io *w, int new_events = EV_UNDEF)
466 CODE: 526 CODE:
467{ 527{
468 RETVAL = w->events; 528 RETVAL = w->events;
469 529
470 if (items > 1) 530 if (items > 1)
471 { 531 {
472 int active = w->active; 532 int active = ev_is_active (w);
473 if (active) ev_io_stop (w); 533 if (active) ev_io_stop (w);
474 534
475 ev_io_set (w, w->fd, new_events); 535 ev_io_set (w, w->fd, new_events);
476 536
477 if (active) ev_io_start (w); 537 if (active) ev_io_start (w);
487void ev_signal_stop (struct ev_signal *w) 547void ev_signal_stop (struct ev_signal *w)
488 548
489void DESTROY (struct ev_signal *w) 549void DESTROY (struct ev_signal *w)
490 CODE: 550 CODE:
491 ev_signal_stop (w); 551 ev_signal_stop (w);
552 e_destroy (w);
492 553
493void set (struct ev_signal *w, SV *signal = 0) 554void set (struct ev_signal *w, SV *signal)
494 CODE: 555 CODE:
495{ 556{
496 Signal signum = sv_signum (signal); /* may croak here */ 557 Signal signum = sv_signum (signal); /* may croak here */
497 int active = w->active; 558 int active = ev_is_active (w);
498 559
499 if (active) ev_signal_stop (w); 560 if (active) ev_signal_stop (w);
561
500 ev_signal_set (w, signum); 562 ev_signal_set (w, signum);
563
501 if (active) ev_signal_start (w); 564 if (active) ev_signal_start (w);
502} 565}
503 566
504MODULE = EV PACKAGE = EV::Time 567int signal (struct ev_signal *w, SV *new_signal = 0)
568 CODE:
569{
570 RETVAL = w->signum;
571
572 if (items > 1)
573 {
574 Signal signum = sv_signum (new_signal); /* may croak here */
575 int active = ev_is_active (w);
576 if (active) ev_signal_stop (w);
577
578 ev_signal_set (w, signum);
579
580 if (active) ev_signal_start (w);
581 }
582}
583 OUTPUT:
584 RETVAL
505 585
506MODULE = EV PACKAGE = EV::Timer PREFIX = ev_timer_ 586MODULE = EV PACKAGE = EV::Timer PREFIX = ev_timer_
507 587
508void ev_timer_start (struct ev_timer *w) 588void ev_timer_start (struct ev_timer *w)
509 INIT: 589 INIT:
516 CHECK_REPEAT (w->repeat); 596 CHECK_REPEAT (w->repeat);
517 597
518void DESTROY (struct ev_timer *w) 598void DESTROY (struct ev_timer *w)
519 CODE: 599 CODE:
520 ev_timer_stop (w); 600 ev_timer_stop (w);
601 e_destroy (w);
521 602
522void set (struct ev_timer *w, NV after, NV repeat = 0.) 603void set (struct ev_timer *w, NV after, NV repeat = 0.)
523 INIT: 604 INIT:
524 CHECK_REPEAT (repeat); 605 CHECK_REPEAT (repeat);
525 CODE: 606 CODE:
526{ 607{
527 int active = w->active; 608 int active = ev_is_active (w);
528 if (active) ev_timer_stop (w); 609 if (active) ev_timer_stop (w);
529 ev_timer_set (w, after, repeat); 610 ev_timer_set (w, after, repeat);
530 if (active) ev_timer_start (w); 611 if (active) ev_timer_start (w);
531} 612}
532 613
539void ev_periodic_stop (struct ev_periodic *w) 620void ev_periodic_stop (struct ev_periodic *w)
540 621
541void DESTROY (struct ev_periodic *w) 622void DESTROY (struct ev_periodic *w)
542 CODE: 623 CODE:
543 ev_periodic_stop (w); 624 ev_periodic_stop (w);
625 e_destroy (w);
544 626
545void set (struct ev_periodic *w, NV at, NV interval = 0.) 627void set (struct ev_periodic *w, NV at, NV interval = 0.)
546 INIT: 628 INIT:
547 CHECK_REPEAT (interval); 629 CHECK_REPEAT (interval);
548 CODE: 630 CODE:
549{ 631{
550 int active = w->active; 632 int active = ev_is_active (w);
551 if (active) ev_periodic_stop (w); 633 if (active) ev_periodic_stop (w);
634
552 ev_periodic_set (w, at, interval); 635 ev_periodic_set (w, at, interval);
636
553 if (active) ev_periodic_start (w); 637 if (active) ev_periodic_start (w);
554} 638}
555 639
556MODULE = EV PACKAGE = EV::Idle PREFIX = ev_idle_ 640MODULE = EV PACKAGE = EV::Idle PREFIX = ev_idle_
557 641
560void ev_idle_stop (struct ev_idle *w) 644void ev_idle_stop (struct ev_idle *w)
561 645
562void DESTROY (struct ev_idle *w) 646void DESTROY (struct ev_idle *w)
563 CODE: 647 CODE:
564 ev_idle_stop (w); 648 ev_idle_stop (w);
649 e_destroy (w);
565 650
566MODULE = EV PACKAGE = EV::Prepare PREFIX = ev_check_ 651MODULE = EV PACKAGE = EV::Prepare PREFIX = ev_check_
567 652
568void ev_prepare_start (struct ev_prepare *w) 653void ev_prepare_start (struct ev_prepare *w)
569 654
570void ev_prepare_stop (struct ev_prepare *w) 655void ev_prepare_stop (struct ev_prepare *w)
571 656
572void DESTROY (struct ev_prepare *w) 657void DESTROY (struct ev_prepare *w)
573 CODE: 658 CODE:
574 ev_prepare_stop (w); 659 ev_prepare_stop (w);
660 e_destroy (w);
575 661
576MODULE = EV PACKAGE = EV::Check PREFIX = ev_check_ 662MODULE = EV PACKAGE = EV::Check PREFIX = ev_check_
577 663
578void ev_check_start (struct ev_check *w) 664void ev_check_start (struct ev_check *w)
579 665
580void ev_check_stop (struct ev_check *w) 666void ev_check_stop (struct ev_check *w)
581 667
582void DESTROY (struct ev_check *w) 668void DESTROY (struct ev_check *w)
583 CODE: 669 CODE:
584 ev_check_stop (w); 670 ev_check_stop (w);
671 e_destroy (w);
585 672
586MODULE = EV PACKAGE = EV::Child PREFIX = ev_child_ 673MODULE = EV PACKAGE = EV::Child PREFIX = ev_child_
587 674
588void ev_child_start (struct ev_child *w) 675void ev_child_start (struct ev_child *w)
589 676
590void ev_child_stop (struct ev_child *w) 677void ev_child_stop (struct ev_child *w)
591 678
592void DESTROY (struct ev_child *w) 679void DESTROY (struct ev_child *w)
593 CODE: 680 CODE:
594 ev_child_stop (w); 681 ev_child_stop (w);
682 e_destroy (w);
595 683
596void set (struct ev_child *w, int pid) 684void set (struct ev_child *w, int pid)
597 CODE: 685 CODE:
598{ 686{
599 int active = w->active; 687 int active = ev_is_active (w);
600 if (active) ev_child_stop (w); 688 if (active) ev_child_stop (w);
689
601 ev_child_set (w, pid); 690 ev_child_set (w, pid);
691
602 if (active) ev_child_start (w); 692 if (active) ev_child_start (w);
603} 693}
604 694
695int pid (struct ev_child *w, int new_pid = 0)
696 CODE:
697{
698 RETVAL = w->pid;
699
700 if (items > 1)
701 {
702 int active = ev_is_active (w);
703 if (active) ev_child_stop (w);
704
705 ev_child_set (w, new_pid);
706
707 if (active) ev_child_start (w);
708 }
709}
710 OUTPUT:
711 RETVAL
712
713
605int status (struct ev_child *w) 714int rstatus (struct ev_child *w)
715 ALIAS:
716 rpid = 1
606 CODE: 717 CODE:
607 RETVAL = w->status; 718 RETVAL = ix ? w->rpid : w->rstatus;
608 OUTPUT: 719 OUTPUT:
609 RETVAL 720 RETVAL
610
611#if 0
612 721
613MODULE = EV PACKAGE = EV::DNS PREFIX = evdns_ 722MODULE = EV PACKAGE = EV::DNS PREFIX = evdns_
614 723
615BOOT: 724BOOT:
616{ 725{
699 808
700void evdns_search_add (char *domain) 809void evdns_search_add (char *domain)
701 810
702void evdns_search_ndots_set (int ndots) 811void evdns_search_ndots_set (int ndots)
703 812
813#if 0
704 814
705MODULE = EV PACKAGE = EV::HTTP PREFIX = evhttp_ 815MODULE = EV PACKAGE = EV::HTTP PREFIX = evhttp_
706 816
707BOOT: 817BOOT:
708{ 818{

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines