Subj : Re: Win32 condition variables redux To : comp.programming.threads From : Joe Seigh Date : Wed Aug 03 2005 09:58 am d|dq wrote: > Anyway, I have come the to the conclusion that Pthreads semantics for > condition variables is way too confusing/sophisticated to be > implemented on top of Win32. > > So, I would settle for a redux version of condition variables... > > For instance, if one assumes the following requirements: > > - Thread cancellation is not supported. > - The external mutex is held by any thread executing a wait, timed > wait, signal or broascast operation. > - The solution does not need to support versions of Windows prior to > Windows 2000. > > - The solution should be based on the Windows API without making any > assumption beyond its documentation. > - The solution should not make assumptions about the underlying > hardware. > > So what would such an implementation look like? > Well if PulseEvent worked (it doesn't) then it would look like a broadcast only solution using SignalAndWait. It would be easy enough to fix in the windows kernel but I guess Microsoft doesn't have the talent they think they have. The problem is ResetEvent makes Events not usable in the way you'd want them to be. You need an eventcount which is sort of a reentrant event. Without that, you're going to have a messy solution no matter what you do. -- Joe Seigh When you get lemons, you make lemonade. When you get hardware, you make software. .