Andrew Stitcher escribió:
On Thu, 2008-06-05 at 19:31 +0200, Manuel Teira wrote:
...
initMutexattr[1](once: 0xffffffff7e14e300, mutexattr: 0xffffffff7e1535f8)
initMutexattr[1](once: 0xffffffff7e14e620, mutexattr: 0xffffffff7e1535d8)
Mutex::Mutex with mutex at 0xffffffff7e14e680 and pthread_mutex_attr_t
at 0x0000000100400758
Error initializing mutex: 0xffffffff7e14e680. Error 0
AllThreadsStatuses ctor. Mutex: 0xffffffff7e14e680

[snip lots of other initMutexattr and Mutex::Mutex nonrelated calls]
initMutexattr[1](once: 0x00000001003f7730, mutexattr: 0x0000000100400758)


I suspect that the static nature of AllThreadStatuses could be involved.
Any thought?

I'm pretty sure you are correct about the static initialisation order.

One problem that your trace points out though is that we will get a
_different_ initialisation for each file including Mutex.h due to the
anonymous namespace used here - this wasn't the intention of this code.
I guess this needs to be fixed by creating a Mutex.cpp to hold this
anonymous namespace. However I'm not sure whether or not this is the
cause of your problem,although it can't help.
Yes. My first thought was that the initMutexattr object was intended as a singleton, hence shared by all the Mutex instances in the process and saving memory and CPU. But since it goes in the .h file, every compilation unit is inlining its own initMutexattr.

Andrew




Reply via email to