Boost logo

Boost :

From: Sohail Somani (s.somani_at_[hidden])
Date: 2007-01-04 20:17:32


> [mailto:boost-bounces_at_[hidden]] On Behalf Of Anthony Williams

[snip]
> I find it strange that
> BOOST_DISABLE_THREADS is defined under these conditions, and
> would rather it
> wasn't.

You and me both.

> However, someone put the checks in there, and must have done
> for a reason, so
> just changing it would seem like a bad idea, unless we have
> suitable tests to
> verify that it's OK.

I personally think it seems to be an oversight. In the file
config/suffix.hpp (which you mentioned as a possible candidate for
change):

//
// If Win32 support is turned off, then we must turn off
// threading support also, unless there is some other
// thread API enabled:
//
#if defined(BOOST_DISABLE_WIN32) && defined(_WIN32) \
   && !defined(BOOST_DISABLE_THREADS) && !defined(BOOST_HAS_PTHREADS)
# define BOOST_DISABLE_THREADS
#endif

The comment does not specify whether threading support is required for
building threads or just using them. In fact, it seems to imply that on
Windows, you cannot use threads without the Windows API. This is
incorrect as I believe John M mentioned in another email.

So how about:

//
// When building boost threads,
// if Win32 support is turned off, then we must turn off
// threading support also, unless there is some other
// thread API enabled:
//
#if defined (BOOST_BUILDING_THREADS) \ <--- defined in Jamfile
   && defined(BOOST_DISABLE_WIN32) && defined(_WIN32) \
   && !defined(BOOST_DISABLE_THREADS) && !defined(BOOST_HAS_PTHREADS)
# define BOOST_DISABLE_THREADS
#endif

I believe with this, the other cases will automagically catch the
correct misconfigurations (example, no _MT_) instead of disallowing this
valid configuration.

Thanks!

Sohail


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk