Subj : Re: recursive mutexes To : comp.programming.threads From : Dragan Cvetkovic Date : Tue May 17 2005 02:26 pm David Butenhof writes: [snip] > A correct and well understood design does not require recursive > mutexes. While recursive mutexes may seem a convenience for debugging, in > fact it's the opposite -- you're better off with a "strict" debugging mutex > (like the POSIX error-check attribute) that checks, tracks, and enforces > ownership restrictions a "normal" mutex may ignore in favor of runtime > efficiency. > > Many implementations may have arrived at the concept of recursive mutexes > for any number of reasons -- some perhaps even because someone really > thought they were a good idea. But allow me to explain, for the sake of > context, why POSIX has recursive mutexes. Bear with me, because I'll follow > into some more objective commentary. [snip of the excellent description of recursive mutex history] > Recursive mutexes can be a great tool for prototyping thread support in an > existing library, exactly because it lets you defer the hard part: the call > path and data dependency analysis of the library. But for that same reason, > always remember that you're not DONE until they're all gone, so you can > produce a library you're proud of, that won't unnecessarily contrain the > concurrency of the entire application. > > Or sit back and let someone else do the design. Dave, you should collect all these essays of yours posted to c.p.t and publish the (long awaited) second edition of your book around it :-) Dragan -- Dragan Cvetkovic, To be or not to be is true. G. Boole No it isn't. L. E. J. Brouwer !!! Sender/From address is bogus. Use reply-to one !!! .