[Patch] Fix gethwnd race

Christopher Faylor cgf-no-personal-reply-please@cygwin.com
Fri May 14 16:20:00 GMT 2004

On Fri, May 14, 2004 at 10:59:42AM -0500, Brian Ford wrote:
>> However, I'll look at your code again with my new understanding of your
>> intent.
>No need.  Just before falling a sleep last night, I remembered a case I
>had not covered correctly.  If the initialization fails the first time,
>the event is not reset.  Can this just be a fatal condition?

I think it should be, yes.  Otherwise, you just have cascading failures
and the thing that eventually causes cygwin to crash may not be the root
cause of the problem.

>I'll cook up a muto based solution in the next few minutes now
>that I understand your preference.  But, I'd like an opinion on the
>question above.

Thanks very much for the offer, but please don't bother.  I took this
opportunity to do some of the cleanup that I was talking about.  I also
implemented a "close handle on final use" option to mutos so that the
event doesn't stay around after the final thread releases it.

I need to do a little debugging on what I have but it does try to clean
up the windows code slightly.  I even eliminated the thread event
synchronization entirely.

Btw, a muto is supposed to be equivalent to a windows mutex in most
respects except that it is supposed to be somewhat lighter weight.


More information about the Cygwin-patches mailing list