Mailing-List: contact cygwin-developers-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-developers-owner AT cygwin DOT com Delivered-To: mailing list cygwin-developers AT cygwin DOT com Date: Mon, 5 Aug 2002 12:49:55 -0400 From: Christopher Faylor To: cygwin-developers AT cygwin DOT com Subject: Re: 1.3.13? Message-ID: <20020805164955.GA6082@redhat.com> Reply-To: cygwin-developers AT cygwin DOT com Mail-Followup-To: cygwin-developers AT cygwin DOT com References: <20020804195150 DOT GA3381 AT redhat DOT com> <124668090713 DOT 20020805140659 AT logos-m DOT ru> <20020805145655 DOT GA4698 AT redhat DOT com> <20020805154128 DOT GA5370 AT redhat DOT com> <20020805175554 DOT H3921 AT cygbert DOT vinschen DOT de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20020805175554.H3921@cygbert.vinschen.de> User-Agent: Mutt/1.3.23.1i On Mon, Aug 05, 2002 at 05:55:54PM +0200, Corinna Vinschen wrote: >On Mon, Aug 05, 2002 at 11:41:28AM -0400, Chris Faylor wrote: >> The below should reduce the window of the race but not eliminate it. >> Does it make any difference to the observed behavior? > >It helps. The behaviour disappered for me. Only... > >> - SuspendThread (info->h); >> + SuspendThread (GetCurrentThreadId ()); > ^^^^^^^^^^^^^^^^^^^^^ >...that should be GetCurrentThread () > > >Question: Why is SetEvent() called at that point at all? Since >__name is set to NULL, detach doesn't call WaitForSingleObject() >anyway. What am I missing now? A race condition. If something sneaks in between the time of the setting of __name to NULL and the setting of the event it would result in the event never being waited for which leaves the event armed. Also, if something is already waiting for the event, it's never going to see the setting of __name. cgf