[pool] Making it honour BOOST_HAS_THREADS

Hello, attached is a patch which makes the pool library honour the general boost threading support flag. As a side effect, it also makes the pool library usable on Tru64 because on that platform you can only include <pthread.h> if you're actually compiling with -pthread. Any objections to applying this patch, anyone? Markus Index: mutex.hpp =================================================================== RCS file: /cvsroot/boost/boost/boost/pool/detail/mutex.hpp,v retrieving revision 1.6 diff -u -r1.6 mutex.hpp --- mutex.hpp 28 Sep 2004 12:55:44 -0000 1.6 +++ mutex.hpp 28 Apr 2005 11:41:20 -0000 @@ -19,6 +19,10 @@ #define BOOST_MUTEX_HELPER_WIN32 1 #define BOOST_MUTEX_HELPER_PTHREAD 2 +#if !defined(BOOST_HAS_THREADS) && !defined(BOOST_NO_MT) +# define BOOST_NO_MT +#endif + #ifdef BOOST_NO_MT // No multithreading -> make locks into no-ops #define BOOST_MUTEX_HELPER BOOST_MUTEX_HELPER_NONE @@ -37,12 +41,13 @@ #error Unable to determine platform mutex type; define BOOST_NO_MT to assume single-threaded #endif - -#ifdef BOOST_WINDOWS - #include <windows.h> -#endif -#ifdef _POSIX_THREADS - #include <pthread.h> +#ifndef BOOST_NO_MT +# ifdef BOOST_WINDOWS +# include <windows.h> +# endif +# ifdef _POSIX_THREADS +# include <pthread.h> +# endif #endif namespace boost { @@ -50,6 +55,8 @@ namespace details { namespace pool { +#ifndef BOOST_NO_MT + #ifdef BOOST_WINDOWS class win32_mutex @@ -102,6 +109,8 @@ #endif // defined(_POSIX_THREADS) +#endif // !defined(BOOST_NO_MT) + class null_mutex { private:

attached is a patch which makes the pool library honour the general boost threading support flag. As a side effect, it also makes the pool library usable on Tru64 because on that platform you can only include <pthread.h> if you're actually compiling with -pthread.
Any objections to applying this patch, anyone?
Looks sensible to me, John.

John Maddock wrote:
attached is a patch which makes the pool library honour the general boost threading support flag. As a side effect, it also makes the pool library usable on Tru64 because on that platform you can only include <pthread.h> if you're actually compiling with -pthread.
Any objections to applying this patch, anyone?
Looks sensible to me,
Applied. Thanks, Markus
participants (2)
-
John Maddock
-
Markus Schöpflin