This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Urgent !!! Need details about signal in cygwin


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]