… | |
… | |
403 | evapi.child_start = ev_child_start; |
403 | evapi.child_start = ev_child_start; |
404 | evapi.child_stop = ev_child_stop; |
404 | evapi.child_stop = ev_child_stop; |
405 | evapi.stat_start = ev_stat_start; |
405 | evapi.stat_start = ev_stat_start; |
406 | evapi.stat_stop = ev_stat_stop; |
406 | evapi.stat_stop = ev_stat_stop; |
407 | evapi.stat_stat = ev_stat_stat; |
407 | evapi.stat_stat = ev_stat_stat; |
|
|
408 | evapi.clear_pending = ev_clear_pending; |
|
|
409 | evapi.invoke = ev_invoke; |
408 | |
410 | |
409 | sv_setiv (sv, (IV)&evapi); |
411 | sv_setiv (sv, (IV)&evapi); |
410 | SvREADONLY_on (sv); |
412 | SvREADONLY_on (sv); |
411 | } |
413 | } |
412 | #ifndef _WIN32 |
414 | #ifndef _WIN32 |
… | |
… | |
426 | |
428 | |
427 | void ev_loop (int flags = 0) |
429 | void ev_loop (int flags = 0) |
428 | |
430 | |
429 | void ev_unloop (int how = 1) |
431 | void ev_unloop (int how = 1) |
430 | |
432 | |
|
|
433 | void ev_feed_fd_event (int fd, int revents = EV_NONE) |
|
|
434 | |
|
|
435 | void ev_feed_signal_event (SV *signal) |
|
|
436 | CODE: |
|
|
437 | { |
|
|
438 | Signal signum = sv_signum (signal); |
|
|
439 | CHECK_SIG (signal, signum); |
|
|
440 | |
|
|
441 | ev_feed_signal_event (EV_DEFAULT_ signum); |
|
|
442 | } |
|
|
443 | |
431 | ev_io *io (SV *fh, int events, SV *cb) |
444 | ev_io *io (SV *fh, int events, SV *cb) |
432 | ALIAS: |
445 | ALIAS: |
433 | io_ns = 1 |
446 | io_ns = 1 |
434 | CODE: |
447 | CODE: |
435 | { |
448 | { |
… | |
… | |
554 | |
567 | |
555 | int ev_is_active (ev_watcher *w) |
568 | int ev_is_active (ev_watcher *w) |
556 | |
569 | |
557 | int ev_is_pending (ev_watcher *w) |
570 | int ev_is_pending (ev_watcher *w) |
558 | |
571 | |
|
|
572 | void ev_invoke (ev_watcher *w, int revents = EV_NONE) |
|
|
573 | |
|
|
574 | int ev_clear_pending (ev_watcher *w) |
|
|
575 | |
|
|
576 | void ev_feed_event (ev_watcher *w, int revents = EV_NONE) |
|
|
577 | |
559 | int keepalive (ev_watcher *w, int new_value = 0) |
578 | int keepalive (ev_watcher *w, int new_value = 0) |
560 | CODE: |
579 | CODE: |
561 | { |
580 | { |
562 | RETVAL = w->flags & WFLAG_KEEPALIVE; |
581 | RETVAL = w->flags & WFLAG_KEEPALIVE; |
563 | new_value = new_value ? WFLAG_KEEPALIVE : 0; |
582 | new_value = new_value ? WFLAG_KEEPALIVE : 0; |
… | |
… | |
595 | } |
614 | } |
596 | } |
615 | } |
597 | OUTPUT: |
616 | OUTPUT: |
598 | RETVAL |
617 | RETVAL |
599 | |
618 | |
600 | void trigger (ev_watcher *w, int revents = EV_NONE) |
|
|
601 | CODE: |
|
|
602 | w->cb (w, revents); |
|
|
603 | |
|
|
604 | int priority (ev_watcher *w, int new_priority = 0) |
619 | int priority (ev_watcher *w, int new_priority = 0) |
605 | CODE: |
620 | CODE: |
606 | { |
621 | { |
607 | RETVAL = w->priority; |
622 | RETVAL = w->priority; |
608 | |
623 | |
609 | if (items > 1) |
624 | if (items > 1) |
610 | { |
625 | { |
611 | int active = ev_is_active (w); |
626 | int active = ev_is_active (w); |
612 | |
|
|
613 | if (new_priority < EV_MINPRI || new_priority > EV_MAXPRI) |
|
|
614 | croak ("watcher priority out of range, value must be between %d and %d, inclusive", EV_MINPRI, EV_MAXPRI); |
|
|
615 | |
627 | |
616 | if (active) |
628 | if (active) |
617 | { |
629 | { |
618 | /* grrr. */ |
630 | /* grrr. */ |
619 | PUSHMARK (SP); |
631 | PUSHMARK (SP); |
620 | XPUSHs (ST (0)); |
632 | XPUSHs (ST (0)); |
|
|
633 | PUTBACK; |
621 | call_method ("stop", G_DISCARD | G_VOID); |
634 | call_method ("stop", G_DISCARD | G_VOID); |
622 | } |
635 | } |
623 | |
636 | |
624 | ev_set_priority (w, new_priority); |
637 | ev_set_priority (w, new_priority); |
625 | |
638 | |
626 | if (active) |
639 | if (active) |
627 | { |
640 | { |
628 | PUSHMARK (SP); |
641 | PUSHMARK (SP); |
629 | XPUSHs (ST (0)); |
642 | XPUSHs (ST (0)); |
|
|
643 | PUTBACK; |
630 | call_method ("start", G_DISCARD | G_VOID); |
644 | call_method ("start", G_DISCARD | G_VOID); |
631 | } |
645 | } |
632 | } |
646 | } |
633 | } |
647 | } |
634 | OUTPUT: |
648 | OUTPUT: |
… | |
… | |
758 | INIT: |
772 | INIT: |
759 | CHECK_REPEAT (repeat); |
773 | CHECK_REPEAT (repeat); |
760 | CODE: |
774 | CODE: |
761 | RESET (timer, w, (w, after, repeat)); |
775 | RESET (timer, w, (w, after, repeat)); |
762 | |
776 | |
|
|
777 | NV at (ev_timer *w) |
|
|
778 | CODE: |
|
|
779 | RETVAL = w->at; |
|
|
780 | OUTPUT: |
|
|
781 | RETVAL |
|
|
782 | |
763 | MODULE = EV PACKAGE = EV::Periodic PREFIX = ev_periodic_ |
783 | MODULE = EV PACKAGE = EV::Periodic PREFIX = ev_periodic_ |
764 | |
784 | |
765 | void ev_periodic_start (ev_periodic *w) |
785 | void ev_periodic_start (ev_periodic *w) |
766 | INIT: |
786 | INIT: |
767 | CHECK_REPEAT (w->interval); |
787 | CHECK_REPEAT (w->interval); |
… | |
… | |
791 | SvREFCNT_dec (w->fh); |
811 | SvREFCNT_dec (w->fh); |
792 | w->fh = SvTRUE (reschedule_cb) ? newSVsv (reschedule_cb) : 0; |
812 | w->fh = SvTRUE (reschedule_cb) ? newSVsv (reschedule_cb) : 0; |
793 | |
813 | |
794 | RESET (periodic, w, (w, at, interval, w->fh ? e_periodic_cb : 0)); |
814 | RESET (periodic, w, (w, at, interval, w->fh ? e_periodic_cb : 0)); |
795 | } |
815 | } |
|
|
816 | |
|
|
817 | NV at (ev_periodic *w) |
|
|
818 | CODE: |
|
|
819 | RETVAL = w->at; |
|
|
820 | OUTPUT: |
|
|
821 | RETVAL |
796 | |
822 | |
797 | MODULE = EV PACKAGE = EV::Idle PREFIX = ev_idle_ |
823 | MODULE = EV PACKAGE = EV::Idle PREFIX = ev_idle_ |
798 | |
824 | |
799 | void ev_idle_start (ev_idle *w) |
825 | void ev_idle_start (ev_idle *w) |
800 | CODE: |
826 | CODE: |