Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!mips!samsung!uunet!mcsun!ukc!stl!robobar!ronald From: ronald@robobar.co.uk (Ronald S H Khoo) Newsgroups: comp.unix.programmer Subject: Re: possible race condition? Message-ID: <1991May9.182241.17090@robobar.co.uk> Date: 9 May 91 18:22:41 GMT References: <1991May9.144935.20078@ge-dab.GE.COM> Organization: Robobar Ltd., Perivale, Middx., ENGLAND. Lines: 24 coleman@sunny.dab.ge.com (Richard Coleman) writes: > > if (fork() != 0) > exit(0); /* parent process exits */ > setpgrp(); /* change process group and lose control tty */ > signal(SIGHUP,SIG_IGN); > Now my questions is this : when the parent process exits, it sends the > signal SIGHUP to all processes in its process group. Is it possible for > this signal to reach the first child process before it executes setpgrp() > and changes its process group? Am I missing something here? Part of the System V interface definition apparently guarantees the child to execute before the parent, I hear -- I'd like chapter and verse from someone who has a copy, if that's not too much trouble. Anyway, there are some System V variants, like the current 386 Xenix which runs processes the other way round, where the hangup is just about guaranteed to hit the child before the setpgrp. So, in principle, yes, you're right, but the code works correctly on "real" System V. -- Ronald Khoo +44 81 991 1142 (O) +44 71 229 7741 (H)