RE: [Boost-Users] detail/lightweight_mutex.hpp
From: Tom Matelich [mailto:tmatelich@zetec.com]
From: Peter Dimov [mailto:pdimov@mmltd.net] From: "Tom Matelich"
I'm attempting to go to Boost 1.28 on our HPUX 10.20 boxes. I've run into a problem with an assumption about the type of pthread_mutexattr_t. detail\lwm_pthreads.hpp calls:
pthread_mutex_init(&m_, 0);
HP's pthread.h (10.20 uses DCE) has that defined as:
int pthread_mutex_init (pthread_mutex_t *,pthread_mutexattr_t);
I don't know what to do about it. My POSIX draft says
int pthread_mutex_init(pthread_mutex_t *restrict mutex, const pthread_mutexattr_t *restrict attr);
and goes on to specify that 0/NULL for the second argument causes default attributes to be used.
I know little - if anything - about HPUX 10.20; if you find a solution let me know, and I'll incorporate it into lwm_pthreads.hpp. Sorry.
The dce documentation I see says to use pthread_mutexattr_default.
http://www.transarc.ibm.com/Library/documentation/dce/1.1/pthread_mutex_init .html
So, it looks like I need to find a version to if or ifdef off of.
I found a define in dce/cma.h (appended to my original email) which seems to fit the bill: /* * Define a symbol which client code can test to determine whether the * underlying threads package is DECthreads or not. This is especially * important to clients of the Pthreads interface who may want to use * certain DECthreads extensions, such as the global lock and non-real-time * scheduling policies, on the DECthreads platform while maintaining * portability to a "vanilla" pthreads implementation. */ #define _DECTHREADS_ 1 Although, I'm not sure how to find out if this should be used generally, or only on HP. ----------------------------------------------------------------------- DISCLAIMER: Information contained in this message and/or attachment(s) may contain confidential information of Zetec, Inc. If you have received this transmission in error, please notify the sender by return email. -----------------------------------------------------------------------
From: "Tom Matelich"
I found a define in dce/cma.h (appended to my original email) which seems
to
fit the bill:
/* * Define a symbol which client code can test to determine whether the * underlying threads package is DECthreads or not. This is especially * important to clients of the Pthreads interface who may want to use * certain DECthreads extensions, such as the global lock and non-real-time * scheduling policies, on the DECthreads platform while maintaining * portability to a "vanilla" pthreads implementation. */ #define _DECTHREADS_ 1
OK, I'll change pthread_mutex_init(&m_, 0); to #if defined(__hpux) && defined(_DECTHREADS_) pthread_mutex_init(&m_, pthread_mutexattr_default); #else pthread_mutex_init(&m_, 0); #endif Let me know if this solves the problem.
participants (2)
-
Peter Dimov
-
Tom Matelich