[ On Wednesday, May 14, 2003 at 10:08:59 (-0500), John Jetmore wrote: ]
> Subject: Re: [Exim] Is it just me, or can't exim count? :)
>
> I know that exim's code has been rewritten from it's smail3-offshoot days,
> but it's still interesting...
The smail-3 child-tracking code should actually be 100% fixed now (in
the as-yet unreleased 3.2.1).
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.
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! ;-)
Part of the problem was fighting against GCC's optimizer and making 100%
certain that all the variables which needed special handling because
they were used in signal handlers where marked "volatile" (or were true
global variables for non-ISO-C compilers), and that the very least
amount of code possible was executed in any signal handler (which
normally should be just one line where a flag variable is set).
Even after all this I fully expect problems to crop up on some types of
operating systems, and perhaps also with other compilers.
--
Greg A. Woods
+1 416 218-0098; <g.a.woods@???>; <woods@???>
Planix, Inc. <woods@???>; VE3TCP; Secrets of the Weird <woods@???>