From: Christopher Kohlhoff (chris_at_[hidden])
Date: 2005-12-12 15:38:16


--- Oliver.Kowalke_at_[hidden] wrote:
> Only if write/sendto is called on a closed socket SIGPIPE
> should be blocked by your library. In all other cases the user
> defined signal handler for SIGPIPE should be called. In your
> solution the user can only ignore SIGPIPE globally (even if
> the signal is generated from other sources than sockets) or
> install its own signal handler - and so be forced to
> distinguish between SIGPIPE from socket and other sources
> (problem - multiple sockets; which socket has generated the
> signal?).

I agree, what you describe is the ideal solution. However I was
unable to work out how to ignore the signal just for some
operations. Can you tell me how to do this?

> Wouldn't it be better to call read/write again if EINTR is
> returned?

IMHO no, because this can prevent an application from shutting
down if they have set a custom handler for SIGINT etc. I think
it is better for the application to handle error::interrupted so
that it can check some app-specific flag to determine whether to
shut down or resume the call.

> /dev/poll is also supported by Linux.

I believe epoll is the close equivalent for linux, and it's
already the default for asio on 2.6 kernel.

Cheers,
Chris