[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [Libevent-users] missing EINTR handling?



On 10/27/09, Eric M. Hopper <hopper@xxxxxxxxxxxxxxx> wrote:
> On Tue, 2009-10-27 at 09:53 -0400, Pierre Phaneuf wrote:
>  > Looking at the evhttp_write() callback handler (in http.c), I see a
>  > call to evbuffer_write() at line 685, which in turns calls write() (at
>  > line 413 of buffer.c), and neither seems to handle EINTR. I see EINTR
>  > handling in evhttp_read(), though. Simple omission?
>  >
>  > I also wonder why EINTR isn't handled at the evbuffer level, say,
>  > since there is pretty much nothing else to do than retry it
>  > immediately, isn't it? As opposed to EAGAIN, say, which requires
>  > retrying it at a later time, when another event comes in...
>
>  Actually, EINTR can be useful for moving signal handling back into the
>  normal flow of a program.  EINTR tells you that one happened so you can
>  go back to the main event loop and dispatch the signal handler if need
>  be.
>
>  I don't know that libevent does this, but that's what I think EINTR is
>  useful for.

Btw, this discussion seem to connect to the non-blocking discussion -
looping on EINTR is safe on non-blocking sockets, but not on blocking
ones, as there is chance to stall the app.

-- 
marko
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.