… | |
… | |
67 | package EV; |
67 | package EV; |
68 | |
68 | |
69 | use strict; |
69 | use strict; |
70 | |
70 | |
71 | BEGIN { |
71 | BEGIN { |
72 | our $VERSION = '1.5'; |
72 | our $VERSION = '1.6'; |
73 | use XSLoader; |
73 | use XSLoader; |
74 | XSLoader::load "EV", $VERSION; |
74 | XSLoader::load "EV", $VERSION; |
75 | } |
75 | } |
76 | |
76 | |
77 | @EV::IO::ISA = |
77 | @EV::IO::ISA = |
… | |
… | |
131 | innermost call to EV::loop return. |
131 | innermost call to EV::loop return. |
132 | |
132 | |
133 | When called with an argument of EV::UNLOOP_ALL, all calls to EV::loop will return as |
133 | When called with an argument of EV::UNLOOP_ALL, all calls to EV::loop will return as |
134 | fast as possible. |
134 | fast as possible. |
135 | |
135 | |
|
|
136 | =item $count = EV::loop_count |
|
|
137 | |
|
|
138 | Return the number of times the event loop has polled for new |
|
|
139 | events. Sometiems useful as a generation counter. |
|
|
140 | |
136 | =item EV::once $fh_or_undef, $events, $timeout, $cb->($revents) |
141 | =item EV::once $fh_or_undef, $events, $timeout, $cb->($revents) |
137 | |
142 | |
138 | This function rolls together an I/O and a timer watcher for a single |
143 | This function rolls together an I/O and a timer watcher for a single |
139 | one-shot event without the need for managing a watcher object. |
144 | one-shot event without the need for managing a watcher object. |
140 | |
145 | |
… | |
… | |
748 | The C<fork_ns> variant doesn't start (activate) the newly created watcher. |
753 | The C<fork_ns> variant doesn't start (activate) the newly created watcher. |
749 | |
754 | |
750 | =back |
755 | =back |
751 | |
756 | |
752 | |
757 | |
|
|
758 | =head1 PERL SIGNALS |
|
|
759 | |
|
|
760 | While Perl signal handling (C<%SIG>) is not affected by EV, the behaviour |
|
|
761 | with EV is as the same as any other C library: Perl-signals will only be |
|
|
762 | handled when Perl runs, which means your signal handler might be invoked |
|
|
763 | only the next time an event callback is invoked. |
|
|
764 | |
|
|
765 | The solution is to use EV signal watchers (see C<EV::signal>), which will |
|
|
766 | ensure proper operations with regards to other event watchers. |
|
|
767 | |
|
|
768 | If you cannot do this for whatever reason, you can also force a watcher |
|
|
769 | to be called on every event loop iteration by installing a C<EV::check> |
|
|
770 | watcher: |
|
|
771 | |
|
|
772 | my $async_check = EV::check sub { }; |
|
|
773 | |
|
|
774 | This ensures that perl shortly gets into control for a short time, and |
|
|
775 | also ensures slower overall operation. |
|
|
776 | |
753 | =head1 THREADS |
777 | =head1 THREADS |
754 | |
778 | |
755 | Threads are not supported by this module in any way. Perl pseudo-threads |
779 | Threads are not supported by this module in any way. Perl pseudo-threads |
756 | is evil stuff and must die. As soon as Perl gains real threads I will work |
780 | is evil stuff and must die. As soon as Perl gains real threads I will work |
757 | on thread support for it. |
781 | on thread support for it. |
… | |
… | |
784 | |
808 | |
785 | 1; |
809 | 1; |
786 | |
810 | |
787 | =head1 SEE ALSO |
811 | =head1 SEE ALSO |
788 | |
812 | |
789 | L<EV::DNS>. |
813 | L<EV::ADNS> (asynchronous dns), L<Glib::EV> (makes Glib/Gtk2 use EV as |
|
|
814 | event loop), L<Coro::EV> (efficient coroutines with EV). |
790 | |
815 | |
791 | =head1 AUTHOR |
816 | =head1 AUTHOR |
792 | |
817 | |
793 | Marc Lehmann <schmorp@schmorp.de> |
818 | Marc Lehmann <schmorp@schmorp.de> |
794 | http://home.schmorp.de/ |
819 | http://home.schmorp.de/ |