Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!lll-winken!uunet!van-bc!sl From: sl@van-bc.UUCP (pri=-10 Stuart Lynne) Newsgroups: comp.unix.wizards Subject: signal(SIGCLD,SIG_IGN) Keywords: race condition Message-ID: <2371@van-bc.UUCP> Date: 15 Apr 89 07:40:15 GMT Organization: Public Access Network, Vancouver, BC. Lines: 39 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@wimsey.bc.ca uunet!van-bc!sl 604-937-7532(voice) 604-939-4768(fax) -- Stuart.Lynne@wimsey.bc.ca uunet!van-bc!sl 604-937-7532(voice) 604-939-4768(fax)