The initialization of pthread synchonization objects in plugins/ipmidirect/thread.cpp should be more portable.
The following code fragments from thread.cpp show the initialization of pthread synchronization objects by copying a static object:
...
static pthread_mutex_t lock_tmpl = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
cThreadLockRw::cThreadLockRw()
{
m_rwlock = rwlock_tmpl;
}
...
static pthread_cond_t cond_tmpl = PTHREAD_COND_INITIALIZER;
cThreadCond::cThreadCond()
{
m_cond = cond_tmpl;
}
The use of pthread synchronization objects initialized in this way is not defined by POSIX. See the comments in the description sections of the following:
http://www.opengroup.org/onlinepubs/000095399/functions/pthread_mutex_init.html
http://www.opengroup.org/onlinepubs/000095399/functions/pthread_rwlock_init.html
http://www.opengroup.org/onlinepubs/000095399/functions/pthread_cond_init.html
Also see the following thread from the comp.programming.threads news group:
I have attached a patch which calls pthread initialization functions instead of using the code above. The patch doesn't include error handling code. The initialization functions are called in constructors. Exceptions could be thrown if these initialization functions fail. However, exceptions are not used in the other plugin code, and I was unsure if exceptions would be the preferred approach.
Patch to make plugins/ipmidirect/thread.cpp more portable
Logged In: YES
user_id=1877074
Originator: YES
I have attached an alternative patch, solaris-thread.cpp.patch. This patch uses ifdefs so that the pthread synchronization objects are dynamically initialized on Solaris. This allows thread.cpp to compile on Solaris without changing the current initialization scheme for synchronization objects on other systems.
File Added: solaris-thread.cpp.patch
An alternative patch to thread.ccp for Solaris
Logged In: YES
user_id=944149
Originator: NO
Solaris patch applied to trunk (rev 6634)
Logged In: YES
user_id=944149
Originator: NO
Patch applied to branch 2.10.x (rev 6654)