Subj : Re: Recursive lock? To : comp.programming.threads From : Peter Koch Larsen Date : Fri May 20 2005 11:28 am "Michel" skrev i en meddelelse news:7N4je.24739$d5.173576@newsb.telia.net... > David Butenhof wrote: > > 8-< snipped discussion about recursive locks > > Thanks for your as usual insightful reply, maybe its time for a "Recursive > locks considered harmful" (to paraphrase Dijkstra) paper/article signed Mr > Butenhof ;) > > Anyways I have a question for the developers on the recursive locks is > evil camp and the win32 platform. Have you made non recursirve wrappers > for the recursive CriticalSection and mutex type? > > /Michel I have my "light" mutex class implemented as a critical section: class lightweight_mutex { bool islocked; CRITICAL_SECTION cs; ..... void acquire() { acquire_critical_section(cs); assert(!locked); locked = true; } }; just pseudo-code... i do not remember the exact code. The check disappears in release-mode. /Peter .