417 Subj : Re: recursive mutexes To : comp.programming.threads,comp.unix.programmer From : David Schwartz Date : Sun May 15 2005 12:56 pm "Uenal Mutlu" <520001085531-0001@t-online.de> wrote in message news:d67fm3$hah$00$1@news.t-online.com... > Recursive locking has less dangers than locking without recursive feature. > Proof: using recursive locking you never can block or deadlock yourself, > but using a locking method without recursive feature you can very easily > deadlock > yourself. > In the latter case even just blocking (ie. waiting for the lock) means > deadlock! > Don't you see that? Okay, suppose I write a function that supposed to only be called if X is not locked. Calling it with X locked is a *bug*. Now suppose I make a mistake -- I am only human. I call the function by mistake with X locked. The function goes to lock X itself. I *want* this to break because it indicates a *bug*. It is *bad* if this just magically works because then the bug will not get discovered. DS . 0