On Fri, 2008-06-06 at 09:12 -0400, Alan Conway wrote: > ... > Its not useless, and it doesn't need to be recursive. It is useful precisely > for > protecting the critical section of a singleton which may run in a static > construtor. It should be used only for static mutex memebers or global mutex > variables - e.g. if we need to put mutexatter in a singleton, we can protect > the > singleton with a PODMutex.
Ah I understand its intent now - this isn't needed in this case because we use pthread_once to achieve the same end ie.it gives exclusion and ensures that the initialisation is only called once. > I agree - and PODMutex is the tool we can use to acomplish that. I can give > this > a shot but probably not today, I'll put it on my list. I don't think using any kind of mutex can help change the static initialisation order! We don't need any further mutual exclusion of the initialisation as above. > > An even better solution would be to drop use of recursive mutexes, which are > evil, but I don't know how big a job that is. Most of the code is written > with > the intent that it not require a recursive mutex but there may be some places > that will deadlock. +1 As an interim measure only using recursive mutexes where necessary will help to see what we have to rework. Andrew
