NAME
IO::Async::Loop::AnyEvent
- use IO::Async
with AnyEvent
SYNOPSIS
use IO::Async::Loop::AnyEvent;
my $loop = IO::Async::Loop::AnyEvent->new();
$loop->add( ... );
$loop->add( IO::Async::Signal->new(
name => 'HUP',
on_receipt => sub { ... },
) );
$loop->run;
DESCRIPTION
This subclass of IO::Async::Loop uses AnyEvent to perform its work.
CONSTRUCTOR
new
$loop = IO::Async::Loop::AnyEvent->new
This function returns a new instance of a IO::Async::Loop::AnyEvent
object.
BUGS
watch_idle
andunwatch_idle
don't work properly againstAnyEvent::Impl::IOAsync
. At least, the unit tests fail, and some scheduled CODErefs never get executed, and sit in the internal queue of the inner-nestedIO::Async::Loop
thatAnyEvent::Impl::IOAsync
itself constructed. An easy workaround here is simply to pick another AnyEvent model, by using thePERL_ANYEVENT_MODEL
environment variable.That all said, I am honestly surprised this is the only thing that breaks, when
IO::Async
is nested uponAnyEvent
itself running atop anotherIO::Async
.The implementation of the
loop_once
method requires the use of an undocumentedAnyEvent
method (one_event
before version 6,_poll
thereafter). This happens to work at the time of writing, but as it is undocumented it may be subject to change.The
loop_forever
method does not rely on this undocumented method, so should be safe from upstream changes. Furthremore, ifAnyEvent
rather thanIO::Async
remains ultimately in control of the runtime, by waiting on condvars, this should not be problematic.
AUTHOR
Paul Evans <leonerd@leonerd.org.uk>