Path: utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!cs.utexas.edu!sun-barr!ccut!wnoc-tyo-news!astemgw!choshi!frf!yang From: yang@nff.ncl.omron.co.jp (YANG Liqun) Newsgroups: comp.lang.c Subject: Re: Catching termination of child process and system() call Message-ID: Date: 23 Jan 91 04:31:30 GMT Sender: news@frf.omron.co.jp Distribution: comp.lang.c Organization: OMRON Corp., Kyoto, Japan Lines: 39 In article <15745vrm@cathedral.cerc.wvu.wvnet.edu> Vasile R. Montan writes: > ... I put the following in my main routine: > > void dowait() >{ > wait(0) It should be wait((int *)0). >main() > { > ... > signal(SIGCHLD, dowait); > ... > } When a child process stopped or exited, SIGCHLD signal will be sent to the process and wait system call itself will catch the SIGCHLD signal from a child. So you do not need to use signal(SIGCHLD, dowait); just use wait(&ret_val) in parent process. I think the problem of your code is that a SIGCHLD signal is sent to parent process when a child process dies, but the signal is caught and then invoke a wait system call which will wait for another SIGCHLD signal. Yang. ----- Li-qun Yang OMRON Computer Technology R&D lab yang@nff.ncl.omron.co.jp tel: 075-951-5111 fax: 075-956-7403 -- ; Li-qun Yang OMRON Computer Technology R&D lab ; yang@nff.ncl.omron.co.jp tel: 075-951-5111 fax: 075-956-7403