[Patch] Fix gethwnd race

Brian Ford ford@vss.fsi.com
Fri May 14 17:40:00 GMT 2004

On Fri, 14 May 2004, Christopher Faylor wrote:

> On Fri, May 14, 2004 at 10:59:42AM -0500, Brian Ford wrote:
> >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.

Ok, good.  I got sucked into an unscheduled meeting anyway.

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

That sounds like a nice, but difficult to get right enhancement.

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

I tried to do that but got stuck when I discovered you can't pass the
return from CreateWindow in one thread to the GetMessage call in another.

I look forward to seeing what you did and learning from it.  Thanks.

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

Yes.  What I don't get is why it is significantly different from a
CriticalSection.  AFAICT, they are the same except mutos don't spin?
I'm still a win32 API newbee.

Brian Ford
Senior Realtime Software Engineer
VITAL - Visual Simulation Systems
FlightSafety International
the best safety device in any aircraft is a well-trained pilot...

More information about the Cygwin-patches mailing list