```{index} single: Coro::Event ``` # Coro::Event ```{pperl-module-badges} Coro::Event ``` `Coro::Event` - Event watchers that block the calling coroutine instead of running a callback. ```perl use Coro; use Coro::Event; async { my $w = Coro::Event->timer(interval => 1); while () { $w->next; # this coroutine sleeps, others run print "tick\n"; } }; Event::loop; ``` Every Event watcher type has a Coro::Event constructor of the same name (`Coro::Event->io(...)`, `->timer(...)`, `->signal(...)`, ...) that takes Event's arguments without a callback. `$w->next` suspends the current coroutine until the watcher's next event and returns it; `Coro::Event::do_io(...)` and friends wait for a single event. While Event's loop waits it lets every ready coroutine run first, so programs written in the linear Coro style and callback code driven by Event share one loop. Run `Event::loop` in the main program or in a coroutine of its own. This is a native implementation of the XS half of Coro 6.57's `Coro::Event`, on the native [Event](Event) module; its `Coro/Event.pm` is used unchanged. ## Differences from upstream None.