signal(SIGPIPE, my_handler);
....
void my_handler(int x)
{
cout << "howdy: " << x << endl;
}
And I would get the howdy: 13 notice after the client exited. And when the client would restart and exit again, the server would go down.
I think it's silly that you have to tell the system that you want to catch the same signal again. Now my handler looks like this:
void my_handler(int x)
{
signal(SIGPIPE, my_handler);
return;
}
Posted by Sam at July 24, 2003 2:15 PM
| TrackBack
Perhaps reading the man man page would help:
PORTABILITY
The original Unix signal() would reset the handler to SIG_DFL, and System V (and the Linux kernel and libc4,5) does the same. On the other hand, BSD does not reset the handler, but blocks new instances of this signal from occurring during a call of the handler. The glibc2 library follows the BSD behaviour.
...
...
Trying to change the semantics of this call using defines and includes is not a good idea. It is better to avoid signal altogether, and use sigaction(2) instead.