Subj : Re: recursive mutexes To : comp.programming.threads From : Uenal Mutlu Date : Wed May 18 2005 10:10 pm "Torsten Robitzki" wrote > Uenal Mutlu wrote: > > > "Torsten Robitzki" wrote > > > >>Uenal Mutlu wrote: > >>> > >>>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. > > > > > > I can only repeat: The code which increments the counter cannot be > > executed by anyone else but the current lock holding thread. > > What will a thread that does not hold the lock prevent it from > incrementing the counter if not by checking if it's holding the lock or > not? What about a policy? FYI: in reply to doug I've posted a code-snippet to show this. > > For which OS and using which threading pkg do you develop? > > OpenVMS/Alpha with some C++ wrapper around pthread. Do you know or believe that your OS makes no use recursive mutexes? I personally cannot believe that any complex system of nowadays like an OS or any server application can be developed without recursive mutices. .