Subj : Re: recursive mutexes To : comp.programming.threads From : Torsten Robitzki Date : Mon May 16 2005 04:06 pm Uenal Mutlu wrote: > "doug" wrote > >>>You seem to not understand what I'm talking about. >>>Do you understand this fact: "Recursive locking is defined for the current >>>lock owning thread only"? >>>Since you already have the lock you can do what ever you want since nobody >>>else can change anything, but you can do! You simply increment it in >>>Lock() >>>and decrement it in Unlock(). Because it is safe because you already have >>>it locked. >>> >> >>Think carefully. How is this possible? > > > It is really basic stuff. Ask yourself how you would extend a non-recursive > locking method to make it recursive? Recursivity starts with the 2nd Lock() > call on the same object within the same thread, true? First one have to check if this lock request comes from the thread holding the mutex or not. This can not be implemented by a simple increment. regards Torsten .