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

Comparing EV/EV.xs (file contents):
Revision 1.33 by root, Thu Nov 1 11:55:54 2007 UTC vs.
Revision 1.35 by root, Thu Nov 1 13:33:12 2007 UTC

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 7#define TIMEOUT_NONE HUGE_VAL
8#define EV_USE_EPOLL 1
9 8
10#define EV_PROTOTYPES 1 9#define EV_PROTOTYPES 1
11#include "EV/EVAPI.h" 10#include "EV/EVAPI.h"
12 11
13#include "libev/ev.c" 12#include "libev/ev.c"
81 w->fh = 0; 80 w->fh = 0;
82 w->cb_sv = newSVsv (cb_sv); 81 w->cb_sv = newSVsv (cb_sv);
83 w->self = self; 82 w->self = self;
84 83
85 return (void *)w; 84 return (void *)w;
85}
86
87static void *
88e_destroy (void *w_)
89{
90 struct ev_watcher *w = w_;
91
92 SvREFCNT_dec (w->fh ); w->fh = 0;
93 SvREFCNT_dec (w->cb_sv); w->cb_sv = 0;
86} 94}
87 95
88static SV * 96static SV *
89e_bless (struct ev_watcher *w, HV *stash) 97e_bless (struct ev_watcher *w, HV *stash)
90{ 98{
438void ev_io_stop (struct ev_io *w) 446void ev_io_stop (struct ev_io *w)
439 447
440void DESTROY (struct ev_io *w) 448void DESTROY (struct ev_io *w)
441 CODE: 449 CODE:
442 ev_io_stop (w); 450 ev_io_stop (w);
451 e_destroy (w);
443 452
444void set (struct ev_io *w, SV *fh, int events) 453void set (struct ev_io *w, SV *fh, int events)
445 CODE: 454 CODE:
446{ 455{
447 int active = w->active; 456 int active = w->active;
500void ev_signal_stop (struct ev_signal *w) 509void ev_signal_stop (struct ev_signal *w)
501 510
502void DESTROY (struct ev_signal *w) 511void DESTROY (struct ev_signal *w)
503 CODE: 512 CODE:
504 ev_signal_stop (w); 513 ev_signal_stop (w);
514 e_destroy (w);
505 515
506void set (struct ev_signal *w, SV *signal = 0) 516void set (struct ev_signal *w, SV *signal = 0)
507 CODE: 517 CODE:
508{ 518{
509 Signal signum = sv_signum (signal); /* may croak here */ 519 Signal signum = sv_signum (signal); /* may croak here */
529 CHECK_REPEAT (w->repeat); 539 CHECK_REPEAT (w->repeat);
530 540
531void DESTROY (struct ev_timer *w) 541void DESTROY (struct ev_timer *w)
532 CODE: 542 CODE:
533 ev_timer_stop (w); 543 ev_timer_stop (w);
544 e_destroy (w);
534 545
535void set (struct ev_timer *w, NV after, NV repeat = 0.) 546void set (struct ev_timer *w, NV after, NV repeat = 0.)
536 INIT: 547 INIT:
537 CHECK_REPEAT (repeat); 548 CHECK_REPEAT (repeat);
538 CODE: 549 CODE:
552void ev_periodic_stop (struct ev_periodic *w) 563void ev_periodic_stop (struct ev_periodic *w)
553 564
554void DESTROY (struct ev_periodic *w) 565void DESTROY (struct ev_periodic *w)
555 CODE: 566 CODE:
556 ev_periodic_stop (w); 567 ev_periodic_stop (w);
568 e_destroy (w);
557 569
558void set (struct ev_periodic *w, NV at, NV interval = 0.) 570void set (struct ev_periodic *w, NV at, NV interval = 0.)
559 INIT: 571 INIT:
560 CHECK_REPEAT (interval); 572 CHECK_REPEAT (interval);
561 CODE: 573 CODE:
573void ev_idle_stop (struct ev_idle *w) 585void ev_idle_stop (struct ev_idle *w)
574 586
575void DESTROY (struct ev_idle *w) 587void DESTROY (struct ev_idle *w)
576 CODE: 588 CODE:
577 ev_idle_stop (w); 589 ev_idle_stop (w);
590 e_destroy (w);
578 591
579MODULE = EV PACKAGE = EV::Prepare PREFIX = ev_check_ 592MODULE = EV PACKAGE = EV::Prepare PREFIX = ev_check_
580 593
581void ev_prepare_start (struct ev_prepare *w) 594void ev_prepare_start (struct ev_prepare *w)
582 595
583void ev_prepare_stop (struct ev_prepare *w) 596void ev_prepare_stop (struct ev_prepare *w)
584 597
585void DESTROY (struct ev_prepare *w) 598void DESTROY (struct ev_prepare *w)
586 CODE: 599 CODE:
587 ev_prepare_stop (w); 600 ev_prepare_stop (w);
601 e_destroy (w);
588 602
589MODULE = EV PACKAGE = EV::Check PREFIX = ev_check_ 603MODULE = EV PACKAGE = EV::Check PREFIX = ev_check_
590 604
591void ev_check_start (struct ev_check *w) 605void ev_check_start (struct ev_check *w)
592 606
593void ev_check_stop (struct ev_check *w) 607void ev_check_stop (struct ev_check *w)
594 608
595void DESTROY (struct ev_check *w) 609void DESTROY (struct ev_check *w)
596 CODE: 610 CODE:
597 ev_check_stop (w); 611 ev_check_stop (w);
612 e_destroy (w);
598 613
599MODULE = EV PACKAGE = EV::Child PREFIX = ev_child_ 614MODULE = EV PACKAGE = EV::Child PREFIX = ev_child_
600 615
601void ev_child_start (struct ev_child *w) 616void ev_child_start (struct ev_child *w)
602 617
603void ev_child_stop (struct ev_child *w) 618void ev_child_stop (struct ev_child *w)
604 619
605void DESTROY (struct ev_child *w) 620void DESTROY (struct ev_child *w)
606 CODE: 621 CODE:
607 ev_child_stop (w); 622 ev_child_stop (w);
623 e_destroy (w);
608 624
609void set (struct ev_child *w, int pid) 625void set (struct ev_child *w, int pid)
610 CODE: 626 CODE:
611{ 627{
612 int active = w->active; 628 int active = w->active;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines