This is the mail archive of the cygwin-developers@cygwin.com 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]

Re: 1.3.13?


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


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