https://issues.apache.org/SpamAssassin/show_bug.cgi?id=5950





--- Comment #8 from Sidney Markowitz <[EMAIL PROTECTED]>  2008-08-05 11:31:59 
PST ---
(in reply to comment #7)
>and for that to abort waiting, if the child itself exits.

I've been reading about how to use SIGCHLD to do that and it seems complicated.
Example code I found uses a SIGCHLD handler, uses waitpid(-1, &WNOHANG) and
checks WIFEXITED($?) to avoid responding to a SIGCHLD sent when the child is
suspended but not exited. Worst, I see that WNOHANG is not supported on all
platforms and I didn't see an alternative way of doing this that does not
require a non-blocking waitpid().

It seems to me that for this purpose it would work fine to wait no more than,
say 5 seconds. All we are doing is making sure that the parent process does not
exit before the log entry (and pid file) is written by the child so that the
invoking shell script does not have to bother waiting for it. If the log entry
is not written by the child in the first few seconds (probably even in the
first second) then something is wrong anyway and it will probably not be
written.

So how about having a SIGUSR1 handler that sets a flag and a loop that for a
maximum of 5 times sleeps 1 second until the flag is set?


-- 
Configure bugmail: 
https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

Reply via email to