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: performance improvement in cygthread::detach()


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.

cgf


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