Xref: utzoo comp.unix.questions:14240 comp.unix.xenix:6331 Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!apple!versatc!mips!prls!philabs!ttidca!quad1!avatar!kory From: kory@avatar.UUCP (Kory Hamzeh) Newsgroups: comp.unix.questions,comp.unix.xenix Subject: Re: help determining child process status Summary: Try kill(pid, 0) Message-ID: <123@avatar.UUCP> Date: 9 Jun 89 00:14:31 GMT References: <1854@leah.Albany.Edu> Distribution: usa Organization: Kory Hamzeh, Canoga Park, Ca, USA Lines: 26 In article <1854@leah.Albany.Edu>, msb62@leah.Albany.Edu (Mitch Baltuch) writes: > I am running SCO Xenix v2.3 on a Zenith Z386, using their v2.3 development > toolkit. My problem is that I have a parent task which forks a number > of tasks. Some of these tasks spawn other tasks based on asynchronous > events, so that the number and duration of these tasks cannot be determined. > I am looking for a way that a task can tell when all its children have > terminated. This is complicated by the fact that one or two processes may > not terminate by themselves and cannot be terminated until all other > processes have exited. I have not been able to find a convenient way to > accomplish this. Any suggestions? If you know the pids of the sub-tasks, you can do a kill(pid, 0). Under Xenix, kill(pid, 0) returns 0 (zero) if the task is still running or -1 if the task is terminated. I have tried this under Xenix and it works. However, I know that it is not very portable to other flavors of Unix. Hope this helps. --kory -- ------------------------------------------------------------------------------- Kory Hamzeh UUCP: ..!uunet!psivax!quad1!avatar!kory INTERNET: avatar!kory@quad.com