tmt@brunix.UUCP (Tom Talpey) (03/14/85)
This caused trouble for me when I wrote a daemon which used a mailbox IPC structure (under V7) and which was awakened by SIGTRAPs from requesting processes. It hung occasionally from races before a pause() and had to be manually goosed when a single requester was active. My solution was to set a 1-second alarm at every signal catch and to reset the tick AFTER a completed pause(). This doesn't eliminate the problem, but the alarm(1) call most always wakes it up one second later and even if THAT sequence races, the next one might win, etc etc. sig_catch(sig) { signal(sig, sig_catch); alarm(1); } sig_wait() { signal(SIGTRAP, sig_catch); signal(SIGALRM, sig_catch); pause(); alarm(0); } This worked quite well for me, modulo the occasional extra pauses, but the daemon wasn't very time-critical and the disk driver lost more signals than the race ever did. The code sprouted about three or four such hooks by the time it worked reliably. Tom Talpey, Brown University Network Operations; ...brunix!tmt