Re: SIGPIPE and SIG_IGN
Re: SIGPIPE and SIG_IGN
- Subject: Re: SIGPIPE and SIG_IGN
- From: Glenn Anderson <email@hidden>
- Date: Tue, 19 Jun 2007 11:25:25 +1200
At 4:09 pm -0700 18/6/2007, email@hidden wrote:
Hello, all ...
In my adventures of making our app also work on Mac OSX (10.4.9,
Intel and PPC), i've discovered that I occasionally get SIGPIPE
signals. This would be fine, except that I specifically ignore them
like this:
// set up our signal handlers
signal( SIGINT, signal_handler );
signal( SIGTERM, signal_handler );
#ifndef WIN32
signal( SIGPIPE, SIG_IGN );
#endif
... so my question is: why do I still get SIGPIPE signals, which
make my program go boom? What else do I need to do such that
SIGPIPE is actually ignored? I don't _always_ get them, but they
come up often enough to be a problem.
SIGPIPE is a per-thread signal, so you need to do signal( SIGPIPE,
SIG_IGN ) on every thread dealing with the relevant sockets.
Alternatively you can use setsockopt() with SOL_SOCKET and
SO_NOSIGPIPE to turn off SIGPIPE for a socket.
Glenn.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden