performance improvement in cygthread::detach()

Christopher Faylor
Fri May 9 17:59:00 GMT 2003

On Fri, May 09, 2003 at 01:11:48PM -0400, Joe Buehler wrote:
>There is a timing race.  On a fast dual-processor machine (e.g.) the
>separate reader thread can be done before the first
>WaitForSingleObject() call in the code above.  SetEvent will be called
>twice before detach() does its first test.  This means that the second
>WaitForSingleObject() will wait 5 mS for an event that will never
>arrive, since raw_read() already did two SetEvent() calls.

Yes, I'm aware of the potential for a 5ms wait.  Since it only happens
rarely in the event of a signal, I didn't think it was a big deal.  The
multiple event setting was intended to be a hint not a real
synchronization point.

However, I'll rewrite it to get rid of the 5ms wait.


More information about the Cygwin-developers mailing list