Boost logo

Boost :

Subject: [boost] [detail/lightweight_mutex] Win32 threading selection in boost/detail/lightweight_mutex.hpp
From: joaquin_at_[hidden]
Date: 2008-12-16 05:09:50


This is a followup of a discussion we had some time ago:

Lines 31-40 of boost/detail/lightweight_mutex.hpp read like this:

#if !defined(BOOST_HAS_THREADS)
# include <boost/detail/lwm_nop.hpp>
#elif defined(BOOST_HAS_PTHREADS)
# include <boost/detail/lwm_pthreads.hpp>
#elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
# include <boost/detail/lwm_win32_cs.hpp>
// Use #define BOOST_DISABLE_THREADS to avoid the error
# error Unrecognized threading platform

I think the conditions for selecting boost/detail/lwm_win32_cs.hpp are
suboptimal because they're ruling out the case where the user's disabled
Pthreads in cygwin/mingw by explicitly defining BOOST_HAS_WINTHREADS,
a case covered by boost/config/platform/cygwin.hpp: in such a situation,
threading is available but none of WIN32 and similar are defined by default
(unless <windows.h> has been previously included, which makes
boost/detail/lightweight_mutex.hpp context dependent).
Wouldn't it be better to change the selection code to the following?

# include <boost/detail/lwm_win32_cs.hpp>

Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo

Boost list run by bdawes at, gregod at, cpdaniel at, john at