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

Comparing EV/EV.xs (file contents):
Revision 1.37 by root, Thu Nov 1 17:17:32 2007 UTC vs.
Revision 1.40 by root, Fri Nov 2 11:09:50 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
9#define EV_PROTOTYPES 1 7#define EV_PROTOTYPES 1
10#include "EV/EVAPI.h" 8#include "EV/EVAPI.h"
11 9
12#include "libev/ev.c" 10#include "libev/ev.c"
13#include "libev/event.h" 11#include "libev/event.h"
14#include "libev/event.c" 12#include "libev/event.c"
15
16#define DNS_USE_GETTIMEOFDAY_FOR_ID 1
17#define HAVE_STRUCT_IN6_ADDR 1
18#define HAVE_STRTOK_R 1
19#include "libev/evdns.c" 13#include "libev/evdns.c"
20 14
21typedef int Signal; 15typedef int Signal;
22 16
23static struct EVAPI evapi; 17static struct EVAPI evapi;
516void DESTROY (struct ev_signal *w) 510void DESTROY (struct ev_signal *w)
517 CODE: 511 CODE:
518 ev_signal_stop (w); 512 ev_signal_stop (w);
519 e_destroy (w); 513 e_destroy (w);
520 514
521void set (struct ev_signal *w, SV *signal = 0) 515void set (struct ev_signal *w, SV *signal)
522 CODE: 516 CODE:
523{ 517{
524 Signal signum = sv_signum (signal); /* may croak here */ 518 Signal signum = sv_signum (signal); /* may croak here */
525 int active = w->active; 519 int active = w->active;
526 520
527 if (active) ev_signal_stop (w); 521 if (active) ev_signal_stop (w);
522
528 ev_signal_set (w, signum); 523 ev_signal_set (w, signum);
524
529 if (active) ev_signal_start (w); 525 if (active) ev_signal_start (w);
530} 526}
527
528int signal (struct ev_signal *w, SV *new_signal = 0)
529 CODE:
530{
531 RETVAL = w->signum;
532
533 if (items > 1)
534 {
535 Signal signum = sv_signum (new_signal); /* may croak here */
536 int active = w->active;
537 if (active) ev_signal_stop (w);
538
539 ev_signal_set (w, signum);
540
541 if (active) ev_signal_start (w);
542 }
543}
544 OUTPUT:
545 RETVAL
531 546
532MODULE = EV PACKAGE = EV::Time 547MODULE = EV PACKAGE = EV::Time
533 548
534MODULE = EV PACKAGE = EV::Timer PREFIX = ev_timer_ 549MODULE = EV PACKAGE = EV::Timer PREFIX = ev_timer_
535 550
577 CHECK_REPEAT (interval); 592 CHECK_REPEAT (interval);
578 CODE: 593 CODE:
579{ 594{
580 int active = w->active; 595 int active = w->active;
581 if (active) ev_periodic_stop (w); 596 if (active) ev_periodic_stop (w);
597
582 ev_periodic_set (w, at, interval); 598 ev_periodic_set (w, at, interval);
599
583 if (active) ev_periodic_start (w); 600 if (active) ev_periodic_start (w);
584} 601}
585 602
586MODULE = EV PACKAGE = EV::Idle PREFIX = ev_idle_ 603MODULE = EV PACKAGE = EV::Idle PREFIX = ev_idle_
587 604
630void set (struct ev_child *w, int pid) 647void set (struct ev_child *w, int pid)
631 CODE: 648 CODE:
632{ 649{
633 int active = w->active; 650 int active = w->active;
634 if (active) ev_child_stop (w); 651 if (active) ev_child_stop (w);
652
635 ev_child_set (w, pid); 653 ev_child_set (w, pid);
654
636 if (active) ev_child_start (w); 655 if (active) ev_child_start (w);
637} 656}
657
658int pid (struct ev_child *w, int new_pid = 0)
659 CODE:
660{
661 RETVAL = w->pid;
662
663 if (items > 1)
664 {
665 int active = w->active;
666 if (active) ev_child_stop (w);
667
668 ev_child_set (w, new_pid);
669
670 if (active) ev_child_start (w);
671 }
672}
673 OUTPUT:
674 RETVAL
675
638 676
639int status (struct ev_child *w) 677int status (struct ev_child *w)
640 CODE: 678 CODE:
641 RETVAL = w->status; 679 RETVAL = w->status;
642 OUTPUT: 680 OUTPUT:

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines