signal(SIGCLD,SIG_IGN)
pri=-10 Stuart Lynne
sl at van-bc.UUCP
Sat Apr 15 17:40:15 AEST 1989
Under SYS V SIGCLD has special behaviour depending on what you pass to the
signal system call.
Specifically if SIG_IGN is used a parent process calling wait() will block
until all child processes die, and child processes will not become zombies
when the exit.
If SIG_DFL is used the parent process will proceed from a wait() after any
child process terminates and child processes will become zombies until the
parent process excutes a wait.
The question is:
If there are child processes in the zombie state when signal(SIGCLD,
SIG_IGN) is executed will they be terminated?
For example in the following code fragment is there a race condition between
the wait() call and the following signal(SIGCLD,SIG_IGN) call?
while (1) {
while(findajob()) {
if (cantfindslot()) {
signal(SIGCLD,SIG_DFL);
wait(&rc); /* race here */
signal(SIGCLD,SIG_IGN); /* race here */
}
startthejob();
}
sleep(30);
}
It seems to be ok. Can anyone who has seen the inner workings of signal()
comment?
--
Stuart.Lynne at wimsey.bc.ca uunet!van-bc!sl 604-937-7532(voice) 604-939-4768(fax)
--
Stuart.Lynne at wimsey.bc.ca uunet!van-bc!sl 604-937-7532(voice) 604-939-4768(fax)
More information about the Comp.unix.wizards
mailing list