Coro::EV - do events the coro-way
use Coro; use Coro::EV; EV::loop;
This module does two things: First, it offers some utility functions that might be useful for coroutines, and secondly, it integrates Coro into the EV main loop:
Before the process blocks (in EV::loop) to wait for events, this module will schedule and run all ready (= runnable) coroutines of the same or higher priority. After that, it will cede once to a coroutine of lower priority, then continue in the event loop.
That means that coroutines with the same or higher pripority as the coroutine running the main loop will inhibit event processing, while coroutines of lower priority will get the CPU, but cannot completeley inhibit event processing.
In general, you should always run EV::loop, either in your main program, or in a separate coroutine. If you don't do that and all coroutines start waiting for some events, this module will run the event loop once, but this is very inefficient.
- $revents = Coro::EV::timed_io_once $fd, $events, $timeout
Blocks the coroutine until either the given event set has occured on the fd, or the timeout has been reached (if timeout is zero, there is no timeout). Returns the received flags.
- Coro::EV::timer_once $after
Blocks the coroutine for at least
Marc Lehmann <firstname.lastname@example.org> http://home.schmorp.de/