Hi,

    We use the signal(SIGCHLD,sample) to get the status of the child
process according which we do further processing.

following is the sample function

void sample(int signo)
{
  char *funcName = "sample()";
  int s = 0;
  int a = -1;
  int get_pid_indx;
  int pid = 0;
  int Debug = 0;

  if ( (pid = waitpid(anypid, NULL, WNOHANG) ) <= 0)
  {
     if (Debug) cout << funcName << ": pid <= 0 : " << pid << endl;
  }
  else
  {
     if (Debug) cout << funcName << ": pid > 0 : " << pid << endl;

     if ( (get_pid_indx = lstOutStandingPids.index(&pid)) != 0)
     {
        int *ptr_pid = new int;
        *ptr_pid = pid;
        lstCompletedPids.insert(ptr_pid);
        ptr_pid = lstOutStandingPids.removeAt(get_pid_indx);
        delete ptr_pid;
     }
  }

  signal(SIGCHLD, sample);
  return;
}

and also we also have a doubt that shall we use signal(SIGCLD,SIG_DFL)
in cygwin??


Pls Kindly advice
VM

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

Reply via email to