On Tue, May 29, 2012 at 09:57:30PM +0400, Denis Bilenko <denis.bile...@gmail.com> wrote: > On Tue, May 29, 2012 at 7:12 PM, Marc Lehmann <schm...@schmorp.de> wrote: > > This one - your test program forks after initialising the default loop, > > without calling ev_default_fork. > > OK, I've fixed the test program to do that and also fixed a fd leak. > It takes a bit longer to fail now, but it still fails.
You also don't call waitpid on your children - can you add error checking to all functions you call, to make sure you really do wait for your children (especially check fork returns)? Most likely you run out of process slots and fork fails, which your code "misinterprets" as a hang. > > Note that this only works because the fork isn't done while the default > > loop exists at the time - if you would fork while the dfeault loop > > existed, you'd have to work with ev_default_fork and probably stop all > > watchers you inherited form the parent. > > At the time of fork there no active watchers in the test program. Well, there are, inside libev. But that's pretty irrelevant, the documentation doesn't say you can ignore the fork if you don't have any active watchers. > To rule out epoll issues, I'm now using EVBACKEND_SELECT explicitly - > still fails. There no pthreads either, so it has to be something else. You still have to call ev_default_fork before you can reuse a loop in the child, there are no exceptions. -- The choice of a Deliantra, the free code+content MORPG -----==- _GNU_ http://www.deliantra.net ----==-- _ generation ---==---(_)__ __ ____ __ Marc Lehmann --==---/ / _ \/ // /\ \/ / schm...@schmorp.de -=====/_/_//_/\_,_/ /_/\_\ _______________________________________________ libev mailing list libev@lists.schmorp.de http://lists.schmorp.de/cgi-bin/mailman/listinfo/libev