Subj : Insane "Metered Section" example on MSDN To : comp.programming.threads From : Agresao Date : Tue Apr 19 2005 02:48 am I was trying to implement a semaphore that won't always do a kernel transition to a Win32 object and came up with some code that seemed to work. Then I found this article on MSDN about this thing called a "metered section": http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndllpro/html/msdn_metrsect.asp The code sample looked very similar to my own efforts which sort of made me think that my solution was correct. However by thinking a little deeper one realizes that their design has a terrible race condition, in which threads are blocked waiting for an auto-reset event to be signaled when there's nobody to signal it. Testing showed that this actually happens. I'm sure some of you have seen this article before and talked about it, but what puzzles me is that it has been in MSDN since 1998 and nobody has bothered to revise it... .