possible race condition?

Richard Coleman coleman at sundae10.DAB.GE.COM
Fri May 10 00:49:35 AEST 1991


I've been reading the book "Unix Network Programming" by
Richard Stevens.  On page 80 he is discussing a code fragment
having to do with a daemon skeleton for SystemV.

  if (fork() != 0)
     exit(0);              /* parent process exits */
  setpgrp();               /* change process group and lose control tty */
  signal(SIGHUP,SIG_IGN);
  if (fork() != 0)
    exit(0);               /* first child process exits */
  /* second child process continues as daemon */


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?
-- 
Richard Coleman
GE Aerospace
Simulation & Control Systems Dept.
coleman at sunny.dab.ge.com



More information about the Comp.unix.programmer mailing list