proposal: defer installing SIGCHLD

2012-05-22 Thread Denis Bilenko
Hi Marc, The patch below defers installing SIGCHLD until the first child watcher is started. Thus, if an application does not use child watchers, libev never installs a SIGCHLD handler. The problem I'm solving with it is this: In gevent 0.x we used libevent which does not reap children. There we

Re: proposal: defer installing SIGCHLD

2012-05-22 Thread Zsbán Ambrus
On Tue, May 22, 2012 at 11:21 AM, Denis Bilenko wrote: > The patch below defers installing SIGCHLD until the first child > watcher is started. Thus, if an application does not use child > watchers, libev never installs a SIGCHLD handler. Couldn't you instead compile with EV_MULTIPLICITY and use a

Re: proposal: defer installing SIGCHLD

2012-05-22 Thread Denis Bilenko
On Tue, May 22, 2012 at 4:49 PM, Zsbán Ambrus wrote: > On Tue, May 22, 2012 at 11:21 AM, Denis Bilenko > wrote: >> The patch below defers installing SIGCHLD until the first child >> watcher is started. Thus, if an application does not use child >> watchers, libev never installs a SIGCHLD handler

Does an event loop support multiple threads?

2012-05-22 Thread Hassink, Brian
I just asked a similar question on the libevent mailing list and was told that it currently does not. I understand libev is modeled on libevent, but thought I'd ask here as well... I'm new to libevent / libev and trying to learn some more about them for potential use in a project. I've worked

How to properly manage client disconnection?

2012-05-22 Thread Kevyn-Alexandre Paré
Hi, Here the source code of a simple server that accept one client. When the client disconnect the callback for io is call infinitely with zero bytes recv. Here the behaviour: first terminal 1) ./main 4) <-- READ: 0 5) <-- READ: 0 6) <-- READ: 0 7) <-- READ: 0 8) CTRL+C second terminal 2

Re: How to properly manage client disconnection?

2012-05-22 Thread Jonathan Neuschäfer
On Tue, May 22, 2012 at 03:32:35PM -0400, Kevyn-Alexandre Paré wrote: > 1) Can I assume that if the recv return zero mean that the client have been > disconnected? Yes, that's what the manpage states: "The return value will be 0 when the peer has performed an orderly shutdown." Thanks, J

Re: Does an event loop support multiple threads?

2012-05-22 Thread Marc Lehmann
On Tue, May 22, 2012 at 02:32:08PM -0400, "Hassink, Brian" wrote: > I just asked a similar question on the libevent mailing list and was told > that it currently does not. I understand libev is modeled on libevent, but > thought I'd ask here as well... both libevent and libev support multiple

Re: proposal: defer installing SIGCHLD

2012-05-22 Thread Marc Lehmann
On Tue, May 22, 2012 at 01:21:35PM +0400, Denis Bilenko wrote: > The patch below defers installing SIGCHLD until the first child > watcher is started. Thus, if an application does not use child > watchers, libev never installs a SIGCHLD handler. That breaks existing applications, so, no. > I kn