delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2008/10/02/06:01:05

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Message-ID: <182dc94a0810020300l57d1bcacw1dfc6a42e98d5611@mail.gmail.com>
Date: Thu, 2 Oct 2008 15:30:18 +0530
From: "Mani kandan" <kvmani76 AT gmail DOT com>
To: cygwin AT cygwin DOT com
Subject: Urgent !!! Need details about signal in cygwin
MIME-Version: 1.0
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019