delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/12/18/10:27:56

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/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
Date: Thu, 18 Dec 2003 10:27:39 -0500
From: Christopher Faylor <cgf-no-personal-reply-please AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: kill(pid, 0) issue
Message-ID: <20031218152739.GA3888@redhat.com>
Mail-Followup-To: cygwin AT cygwin DOT com
References: <E087F7025D7E494B8015119695CEDB4C0209B0C0 AT zpl02exm01 DOT mpsc DOT mot DOT com>
Mime-Version: 1.0
In-Reply-To: <E087F7025D7E494B8015119695CEDB4C0209B0C0@zpl02exm01.mpsc.mot.com>
User-Agent: Mutt/1.4.1i
X-IsSubscribed: yes
Reply-To: cygwin AT cygwin DOT com

On Thu, Dec 18, 2003 at 10:34:12AM +0100, Nowakowski Maciej-AMN011 wrote:
>>I suspect that you are not 'wait()'ing for the process to exit before
>>checking if it exists.  kill(pid, 0) will succeed on both linux and
>>cygwin if the process is not reaped by calling wait (or waitpid, etc.)
>>first.
>
>Thanks for a reply.  I have run your test case and it really works.  So
>then I have modified it slightly to make it similar to what my
>application is doing.  Now it reproduces the behaviour of my app.  I'm
>running this test below in a Windows console and using Cygwin console
>to display processes issuing 'ps' command.  I have expected the child
>process to be finished after some time(when main process is blocked on
>'getc()') but kill(pid, 0) returns 0.
>
>Probably there is an issue lying beneath I'm not aware of.

As I said in my response to you, you DO have to wait for a pid if you
want kill(pid, 0) to return -1.

I'm not sure why you are sending a test case which illustrates exactly
what I told you the problem is.  Apparently you didn't read the part
that I quoted above.

--
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