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

Comparing cvsroot/EV/EV.xs (file contents):
Revision 1.32 by root, Thu Nov 1 11:11:39 2007 UTC vs.
Revision 1.34 by root, Thu Nov 1 12:11:07 2007 UTC

81 w->fh = 0; 81 w->fh = 0;
82 w->cb_sv = newSVsv (cb_sv); 82 w->cb_sv = newSVsv (cb_sv);
83 w->self = self; 83 w->self = self;
84 84
85 return (void *)w; 85 return (void *)w;
86}
87
88static void *
89e_destroy (void *w_)
90{
91 struct ev_watcher *w = w_;
92
93 SvREFCNT_dec (w->fh ); w->fh = 0;
94 SvREFCNT_dec (w->cb_sv); w->cb_sv = 0;
86} 95}
87 96
88static SV * 97static SV *
89e_bless (struct ev_watcher *w, HV *stash) 98e_bless (struct ev_watcher *w, HV *stash)
90{ 99{
291 evapi.child_stop = ev_child_stop; 300 evapi.child_stop = ev_child_stop;
292 301
293 sv_setiv (sv, (IV)&evapi); 302 sv_setiv (sv, (IV)&evapi);
294 SvREADONLY_on (sv); 303 SvREADONLY_on (sv);
295 } 304 }
305
306 pthread_atfork (ev_fork_prepare, ev_fork_parent, ev_fork_child);
296} 307}
297 308
298NV ev_now () 309NV ev_now ()
299 CODE: 310 CODE:
300 RETVAL = ev_now; 311 RETVAL = ev_now;
436void ev_io_stop (struct ev_io *w) 447void ev_io_stop (struct ev_io *w)
437 448
438void DESTROY (struct ev_io *w) 449void DESTROY (struct ev_io *w)
439 CODE: 450 CODE:
440 ev_io_stop (w); 451 ev_io_stop (w);
452 e_destroy (w);
441 453
442void set (struct ev_io *w, SV *fh, int events) 454void set (struct ev_io *w, SV *fh, int events)
443 CODE: 455 CODE:
444{ 456{
445 int active = w->active; 457 int active = w->active;
498void ev_signal_stop (struct ev_signal *w) 510void ev_signal_stop (struct ev_signal *w)
499 511
500void DESTROY (struct ev_signal *w) 512void DESTROY (struct ev_signal *w)
501 CODE: 513 CODE:
502 ev_signal_stop (w); 514 ev_signal_stop (w);
515 e_destroy (w);
503 516
504void set (struct ev_signal *w, SV *signal = 0) 517void set (struct ev_signal *w, SV *signal = 0)
505 CODE: 518 CODE:
506{ 519{
507 Signal signum = sv_signum (signal); /* may croak here */ 520 Signal signum = sv_signum (signal); /* may croak here */
527 CHECK_REPEAT (w->repeat); 540 CHECK_REPEAT (w->repeat);
528 541
529void DESTROY (struct ev_timer *w) 542void DESTROY (struct ev_timer *w)
530 CODE: 543 CODE:
531 ev_timer_stop (w); 544 ev_timer_stop (w);
545 e_destroy (w);
532 546
533void set (struct ev_timer *w, NV after, NV repeat = 0.) 547void set (struct ev_timer *w, NV after, NV repeat = 0.)
534 INIT: 548 INIT:
535 CHECK_REPEAT (repeat); 549 CHECK_REPEAT (repeat);
536 CODE: 550 CODE:
550void ev_periodic_stop (struct ev_periodic *w) 564void ev_periodic_stop (struct ev_periodic *w)
551 565
552void DESTROY (struct ev_periodic *w) 566void DESTROY (struct ev_periodic *w)
553 CODE: 567 CODE:
554 ev_periodic_stop (w); 568 ev_periodic_stop (w);
569 e_destroy (w);
555 570
556void set (struct ev_periodic *w, NV at, NV interval = 0.) 571void set (struct ev_periodic *w, NV at, NV interval = 0.)
557 INIT: 572 INIT:
558 CHECK_REPEAT (interval); 573 CHECK_REPEAT (interval);
559 CODE: 574 CODE:
571void ev_idle_stop (struct ev_idle *w) 586void ev_idle_stop (struct ev_idle *w)
572 587
573void DESTROY (struct ev_idle *w) 588void DESTROY (struct ev_idle *w)
574 CODE: 589 CODE:
575 ev_idle_stop (w); 590 ev_idle_stop (w);
591 e_destroy (w);
576 592
577MODULE = EV PACKAGE = EV::Prepare PREFIX = ev_check_ 593MODULE = EV PACKAGE = EV::Prepare PREFIX = ev_check_
578 594
579void ev_prepare_start (struct ev_prepare *w) 595void ev_prepare_start (struct ev_prepare *w)
580 596
581void ev_prepare_stop (struct ev_prepare *w) 597void ev_prepare_stop (struct ev_prepare *w)
582 598
583void DESTROY (struct ev_prepare *w) 599void DESTROY (struct ev_prepare *w)
584 CODE: 600 CODE:
585 ev_prepare_stop (w); 601 ev_prepare_stop (w);
602 e_destroy (w);
586 603
587MODULE = EV PACKAGE = EV::Check PREFIX = ev_check_ 604MODULE = EV PACKAGE = EV::Check PREFIX = ev_check_
588 605
589void ev_check_start (struct ev_check *w) 606void ev_check_start (struct ev_check *w)
590 607
591void ev_check_stop (struct ev_check *w) 608void ev_check_stop (struct ev_check *w)
592 609
593void DESTROY (struct ev_check *w) 610void DESTROY (struct ev_check *w)
594 CODE: 611 CODE:
595 ev_check_stop (w); 612 ev_check_stop (w);
613 e_destroy (w);
596 614
597MODULE = EV PACKAGE = EV::Child PREFIX = ev_child_ 615MODULE = EV PACKAGE = EV::Child PREFIX = ev_child_
598 616
599void ev_child_start (struct ev_child *w) 617void ev_child_start (struct ev_child *w)
600 618
601void ev_child_stop (struct ev_child *w) 619void ev_child_stop (struct ev_child *w)
602 620
603void DESTROY (struct ev_child *w) 621void DESTROY (struct ev_child *w)
604 CODE: 622 CODE:
605 ev_child_stop (w); 623 ev_child_stop (w);
624 e_destroy (w);
606 625
607void set (struct ev_child *w, int pid) 626void set (struct ev_child *w, int pid)
608 CODE: 627 CODE:
609{ 628{
610 int active = w->active; 629 int active = w->active;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines