title: Tracking the death of a child process
body: <p>How could I track down the death of a child process without making the parent process wait until the child process got killed?</p>
  
  <p>I am trying a client-server scenario where the server accepts the connection from a client and forks a new process for each and every connection it accepts. </p>
  
  <p>I am ignoring SIGCHLD signals to prevent zombie creation.</p>
  
  <pre><code>signal(SIGCHLD, SIG_IGN);
  while(1)
  {
    accept();
    clients++;
    if(fork() ==0)
    {
       childfunction();
       clients--;
    }
    else
    {
    }
  }
  </code></pre>
  
  <p>The problem in the above scenario is that if the child process gets killed in the <code>childfunction()</code> function, the global variable <code>clients</code> is not getting decremented.</p>
  
  <p><strong>NOTE:</strong> I am looking for a solution without using SIGCHLD signal ... If possible</p>