Subject: Re: signal confusion
To: Paul B Dokas <dokas@cs.umn.edu>
From: Robert Elz <kre@munnari.OZ.AU>
List: current-users
Date: 11/06/1998 07:17:07
Date: Thu, 5 Nov 1998 13:09:16 -0600 (CST)
From: Paul B Dokas <dokas@cs.umn.edu>
Message-ID: <Pine.GSO.4.05.9811051259490.15308-100000@augustus-239.cs.umn.edu>
| Isn't this exactly the case that POSIX signals were designed to avoid
| (the surpising lose of signals)?
No, not that way.
Signals are never queued, there's just a bit mask, you either have a
signal (of a specific type) pending, or you do not, there can never
be two of a type. What the newer signal handling does is avoid races
where you have just cleared one signal, and a second is queued - now that
second one will reliably be delivered, before all kinds of weird things
can happen (from simply losing the signal to killing the process).
To do what you want you need a loop doing wait(), almost certainly with
WNOHANG enabled, so you catch all the processes that have exited since you
last took the signal (and don't be surprised if there are none of them, that
can happen too).
kre