Subj : Win32 condition variables redux To : comp.programming.threads From : d|dq Date : Wed Aug 03 2005 01:25 am I have read countless emails from very serious people...Alexander Terekhov, Joe Seigh, David Schwartz, Dave Butenhof, Chris Thomasson, etc. You all seem to know a little bit on the topic. ;) I have looked at many implementations of Win32 POSIX-like condition variables, including pthreads-w32, Austria C++, Boost, cygwin, Apache Portable Runtime (APR), Pelt, the implementation Joe Seigh posted here, Douglas C. Schmidt's recommended implementations, Alexander Terekhov and Louis Thomas' various algorithms (one of them being the base of pthreads-w32)...and a few others. My head is still spinning. (maybe on a spinlock) 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? Many implementations out there simply do not work or do not work well. Others are reputed to work, but they are so complicated that I can't decide if I can trust them or not. So, before I go on a limb and pick something that looks reasonable to me (and might still be "braindead"TM), I would like to know what you, fellow experts, think. BTW, those Interlocked* APIs are often bashed for all sorts of reasons, event objects also have their detractors, and I even found people to complain about EnterCriticalSection/LeaveCriticalSection! I am not interested in getting the maximum performance the underlying hardware could offer. I just want something that works reliably and can be read without headache. Therefore, using these APIs/facilities is OK with me. Any helpers/takers? .