… | |
… | |
24 | running the main loop will inhibit event processing, while threads of |
24 | running the main loop will inhibit event processing, while threads of |
25 | lower priority will get the CPU, but cannot completeley inhibit event |
25 | lower priority will get the CPU, but cannot completeley inhibit event |
26 | processing. Note that for that to work you actually have to run the EV |
26 | processing. Note that for that to work you actually have to run the EV |
27 | event loop in some thread. |
27 | event loop in some thread. |
28 | |
28 | |
29 | =head2 RUNNING WITH OR WITHOUT A MAINLOOP |
29 | =head1 RUNNING WITH OR WITHOUT A MAINLOOP |
30 | |
30 | |
31 | In general, you should always run EV::loop, either in your main program, |
31 | In general, you should always run EV::loop, either in your main program, |
32 | or in a separate coroutine. If you don't do that and all coroutines |
32 | or in a separate coroutine. If you don't do that and all coroutines |
33 | start waiting for some events, this module will run the event loop once, |
33 | start waiting for some events, this module will run the event loop once, |
34 | but this is very inefficient and will also not make it possible to run |
34 | but this is very inefficient and will also not make it possible to run |
… | |
… | |
72 | }; |
72 | }; |
73 | $IDLE->{desc} = "[EV idle process]"; |
73 | $IDLE->{desc} = "[EV idle process]"; |
74 | |
74 | |
75 | $Coro::idle = $IDLE; |
75 | $Coro::idle = $IDLE; |
76 | |
76 | |
77 | =item $revents = Coro::EV::timed_io_once $fileno_or_fh, $events, $timeout |
77 | =item $revents = Coro::EV::timed_io_once $fileno_or_fh, $events[, $timeout] |
78 | |
78 | |
79 | Blocks the coroutine until either the given event set has occured on the |
79 | Blocks the coroutine until either the given event set has occured on the |
80 | fd, or the timeout has been reached (if timeout is zero, there is no |
80 | fd, or the timeout has been reached (if timeout is missing or C<undef> |
81 | timeout). Returns the received flags. |
81 | then there will be no timeout). Returns the received flags. |
82 | |
82 | |
83 | =item Coro::EV::timer_once $after |
83 | =item Coro::EV::timer_once $after |
84 | |
84 | |
85 | Blocks the coroutine for at least C<$after> seconds. |
85 | Blocks the coroutine for at least C<$after> seconds. |
86 | |
86 | |