EV::loop not exiting when all AnyEvent watchers destroyed?

Marc Lehmann schmorp at schmorp.de
Sat Aug 22 01:02:45 CEST 2009


On Fri, Aug 21, 2009 at 11:15:44AM -0700, Mark Kidwell <MKidwell at looksmart.net> wrote:
> 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

Probably something still has a watcher, so this would be expected (and
correct) behaviour.

Note that AnyEvent does not offer the functionality you want, anyevent has
to offer the same interface for every event loop, and no other event loop
has thisfeature, so anyevent can not offer it.

> Devel::FindRef::track code in AnyEvent::Handle::destroy which shows that
> the read watcher on the handle created by the AnyEvent::HTTP request
> somehow has a refcount go from 1 to 2 between the time it's set up in
> AnyEvent::Handle::start_read and destroy, but one of those refs is lost:

That's quite possible to be normal behaviour. I will look into this, but note
it won't solve your problem.

AnyEvent libraries (and Anyevent itself!) can and will use long-running
watchers, this is legal, and you have to cope with this.

-- 
                The choice of a       Deliantra, the free code+content MORPG
      -----==-     _GNU_              http://www.deliantra.net
      ----==-- _       generation
      ---==---(_)__  __ ____  __      Marc Lehmann
      --==---/ / _ \/ // /\ \/ /      pcg at goof.com
      -=====/_/_//_/\_,_/ /_/\_\



More information about the anyevent mailing list