EV::loop not exiting when all AnyEvent watchers destroyed?
Robin Redeker
elmex at ta-sa.org
Sat Aug 22 09:42:56 CEST 2009
Hi Mark!
On Fri, Aug 21, 2009 at 11:15:44AM -0700, Mark Kidwell wrote:
> Hi,
>
> I have a server program that relies on EV::loop's behavior to return
> when there are no active watchers. However when I use AnyEvent::HTTP to
> asynchronously fetch URLs, EV::loop never returns, even when it appears
> that all work is done - see the sample program that demonstrates this
> below. This occurs on Perl 5.10.0 and earlier, running EV 3.8 / AnyEvent
> 5.111 / AnyEvent::HTTP 1.43, all on x86_64 Linux (2.6.24 kernel, libc
> 2.7).
As Marc pointed out, you'll have to explicitly stop the event loop. You could
for instance just call EV::unloop when you got all the request results. Or you
don't call EV::loop directly (if possible) and use AnyEvent's condition
variables to wait for the "all requests are done" condition.
Here an example:
http://www.ta-sa.org/files/txt/5f68b006dd8ea81ddd7333cff8aebc63.txt
Greetings,
Robin
--
Robin Redeker | Deliantra, the free code+content MORPG
elmex at ta-sa.org / r.redeker at gmail.com | http://www.deliantra.net
http://www.ta-sa.org/ |
More information about the anyevent
mailing list