… | |
… | |
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 | |
21 | typedef int Signal; |
15 | typedef int Signal; |
22 | |
16 | |
23 | static struct EVAPI evapi; |
17 | static struct EVAPI evapi; |
… | |
… | |
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 | |
|
|
528 | int signal (struct ev_signal *w, SV *new_signal = 0) |
|
|
529 | CODE: |
|
|
530 | { |
|
|
531 | Signal signum = new_signal ? sv_signum (signal) : 0; /* may croak here */ |
|
|
532 | RETVAL = w->signum; |
|
|
533 | |
|
|
534 | if (items > 1) |
|
|
535 | { |
|
|
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 | |
532 | MODULE = EV PACKAGE = EV::Time |
547 | MODULE = EV PACKAGE = EV::Time |
533 | |
548 | |
534 | MODULE = EV PACKAGE = EV::Timer PREFIX = ev_timer_ |
549 | MODULE = 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 | |
586 | MODULE = EV PACKAGE = EV::Idle PREFIX = ev_idle_ |
603 | MODULE = EV PACKAGE = EV::Idle PREFIX = ev_idle_ |
587 | |
604 | |
… | |
… | |
630 | void set (struct ev_child *w, int pid) |
647 | void 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 | |
|
|
658 | int pid (struct ev_child *w, int new_pid = 0) |
|
|
659 | CODE: |
|
|
660 | { |
|
|
661 | RETVAL = newSVsv (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 | |
639 | int status (struct ev_child *w) |
677 | int status (struct ev_child *w) |
640 | CODE: |
678 | CODE: |
641 | RETVAL = w->status; |
679 | RETVAL = w->status; |
642 | OUTPUT: |
680 | OUTPUT: |