error in boost/config/platform/hpux.hpp (thread support)

Here is the code that handle thread support in boost/config/platform/hpux.hpp : #if defined(__GNUC__) # if (__GNUC__ < 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ < 3)) // GNU C on HP-UX does not support threads (checked up to gcc 3.3) # define BOOST_DISABLE_THREADS # elif !defined(BOOST_DISABLE_THREADS) // threads supported from gcc-3.3 onwards: # define BOOST_HAS_THREADS # define BOOST_HAS_PTHREADS # endif #endif This code does not set BOOST_HAS_THREADS and BOOST_HAS_PTHREADS when compiling with aCC on HP-UX. This cause the boost::shared_ptr to be unsafe in a multithreaded environment . We fixed this problem by adding the following lines in user.hpp : // Enable threading support with aCC !! #ifdef _AMD_THREADS_ # ifdef _AMD_UNIX_HPUX_ # define BOOST_HAS_THREADS # define BOOST_HAS_PTHREADS # endif #endif But I suggest that in future release you use the following code in boost/config/platform/hpux.hpp #if defined(__GNUC__) # if (__GNUC__ < 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ < 3)) // GNU C on HP-UX does not support threads (checked up to gcc 3.3) # define BOOST_DISABLE_THREADS # endif #endif #if !defined(BOOST_DISABLE_THREADS) // threads supported # define BOOST_HAS_THREADS # define BOOST_HAS_PTHREADS # endif Maybe it will be necessary to check aCC version and set BOOST_DISABLE_THREADS for old aCC version that do not have thread suport... Regards Julien

Julien Delacroix wrote:
Maybe it will be necessary to check aCC version and set BOOST_DISABLE_THREADS for old aCC version that do not have thread suport...
It appears the problem is that unistd.h doesn't define _POSIX_THREADS so our config system doesn't detect threading support when you build with -mt. Unless anyone objects I'll add a #define BOOST_HAS_PTHREADS to hpux.hpp which will turn on threading support only when the compiler is used with -mt (which defines _REENTRANT which then gets detected by the config system etc). John.
participants (2)
-
John Maddock
-
Julien Delacroix