Subj : Re: Recursive lock? To : comp.programming.threads From : doug Date : Thu May 19 2005 07:44 pm "Michel" wrote in message 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 Yeah, we wrap them up. We do this because we write our code to an 'isolation layer' api. We then write an isolation layer for each operating system, mapping the api calls to the primitives supported on that machine. It's not the fastest way to do it, but it's portable, and in debug builds we can add in code for things like: - double acquires - invalid frees - high contention (lots of threads waiting for some lock) - long holds (a thread holds a lock for a long time) - hierarchy checking Means we don't have to touch the app code when we port. Doug .