Opened 14 years ago

Closed 14 years ago

#2675 closed Bugs (fixed)

Win32 threading selection in boost/detail/lightweight_mutex.hpp

Reported by: Joaquín M López Muñoz Owned by: Peter Dimov
Milestone: Boost 1.39.0 Component: smart_ptr
Version: Boost 1.37.0 Severity: Problem
Keywords: Cc:

Description

(See discussion at http://lists.boost.org/Archives/boost/2008/12/146172.php)

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>
#else
// Use #define BOOST_DISABLE_THREADS to avoid the error
# error Unrecognized threading platform
#endif

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, Win32 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).

As per the discussion carried out in the list, I think the best resolution is to have the Win32 selection pp code changed to

#elif defined(BOOST_HAS_WINTHREADS) ||\
      defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
# include <boost/detail/lwm_win32_cs.hpp>
#else

Change History (3)

comment:1 by Peter Dimov, 14 years ago

Milestone: Boost 1.38.0Boost 1.39.0
Status: newassigned

comment:2 by Peter Dimov, 14 years ago

(In [51515]) Refs #2675 (fixed in trunk.)

comment:3 by Peter Dimov, 14 years ago

Resolution: fixed
Status: assignedclosed

(In [51536]) Merge [51515] to release. Closes #2675.

Note: See TracTickets for help on using tickets.