1.3.13?

Christopher Faylor cgf@redhat.com
Mon Aug 5 09:50:00 GMT 2002


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



More information about the Cygwin-developers mailing list