On Wed, 14 May 2003, Greg A. Woods wrote:
> The problem is rather hairy since since the counters and linked lists
> have to be updated after signal handlers have delivered asynchronous
> events to the parent process.
The counting code in Exim does not rely on signal handlers at all. Early
on I had problems with handling SIGCHLD, so Exim doesn't use that
signal. Instead, the daemon calls waitpid() repeatedly in non-blocking
mode every time it wakes up, until it has reaped all completed
subprocesses.
> I learned an awful lot more about writing safe signal handling code
> while fixing this bug, and while doing similar coding for a new version
> of inetd, and that's after already having many years experience doing
> the same kind of coding and thinking that I already knew what I was
> doing all along! ;-)
That stuff is hairy. I've had some past experience (not on Unix) and I
keep well clear if I can.
--
Philip Hazel University of Cambridge Computing Service,
ph10@??? Cambridge, England. Phone: +44 1223 334714.