Boost logo

Boost :

From: Tobias Schwinger (tschwinger_at_[hidden])
Date: 2005-07-03 18:38:50


Hi,

here is a patch for the Borland regression of Boost.Thread.

The problem:
------------

For some odd reasons BCC 5.6.4 fails to export a symbol for the destructor of
read_write_mutex_impl.

Solution annotations:
---------------------

1.1. Forced template instantiation of the destructor (which again needed a
workaround, because explicit instantiation of a destructor does not seem to work)
and it did not help
1.2. The destructor currently only contains assertions so I ended up commenting it

2.1. There are still some warnings (unreachable code, condition always true)
wasn't sure whether it's safe to disable them
2.2. Tested with 5.6.5 and it works without the workaround (that's why there is no
BOOST_TESTED_AT)
2.3. Tested with 5.5.0 and 5.5.1 and solved another minor problem with windows
headers (size_t isn't visible at root namespace when compiling once.cpp)
2.4. Compiled and ran the read_write_mutex test for all compilers and it passed
2.5. Someone should perhaps test if Kylix needs the 5.6.4-workaround as well

Regards,

Tobias

Index: boost/thread/read_write_mutex.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/thread/read_write_mutex.hpp,v
retrieving revision 1.8
diff -u -r1.8 read_write_mutex.hpp
--- boost/thread/read_write_mutex.hpp 29 Mar 2005 21:45:54 -0000 1.8
+++ boost/thread/read_write_mutex.hpp 3 Jul 2005 23:31:39 -0000
@@ -19,6 +19,7 @@
 #include <boost/thread/detail/config.hpp>
 
 #include <boost/utility.hpp>
+#include <boost/detail/workaround.hpp>
 
 #include <boost/thread/mutex.hpp>
 #include <boost/thread/detail/lock.hpp>
@@ -52,7 +53,9 @@
     typedef detail::thread::scoped_timed_lock<Mutex> scoped_timed_lock;
 
     read_write_mutex_impl(read_write_scheduling_policy::read_write_scheduling_policy_enum sp);
+#if !BOOST_WORKAROUND(__BORLANDC__,<= 0x564)
     ~read_write_mutex_impl();
+#endif
 
     Mutex m_prot;
 

Index: libs/thread/src/read_write_mutex.cpp
===================================================================
RCS file: /cvsroot/boost/boost/libs/thread/src/read_write_mutex.cpp,v
retrieving revision 1.20
diff -u -r1.20 read_write_mutex.cpp
--- libs/thread/src/read_write_mutex.cpp 3 May 2005 20:42:09 -0000 1.20
+++ libs/thread/src/read_write_mutex.cpp 3 Jul 2005 23:36:16 -0000
@@ -27,6 +27,8 @@
 #include <boost/thread/read_write_mutex.hpp>
 #include <boost/thread/xtime.hpp>
 
+#include <boost/detail/workaround.hpp>
+
 #if !defined(BOOST_NO_STRINGSTREAM)
 # include <sstream>
 #endif
@@ -376,6 +378,7 @@
     , m_readers_next(true)
 {}
 
+#if !BOOST_WORKAROUND(__BORLANDC__, <= 0x564)
 template<typename Mutex>
 read_write_mutex_impl<Mutex>::~read_write_mutex_impl()
 {
@@ -390,6 +393,7 @@
     BOOST_ASSERT(m_num_waking_readers == 0);
     BOOST_ASSERT(m_num_max_waking_readers == 0);
 }
+#endif
 
 template<typename Mutex>
 void read_write_mutex_impl<Mutex>::do_read_lock()

Index: libs/thread/src/once.cpp
===================================================================
RCS file: /cvsroot/boost/boost/libs/thread/src/once.cpp,v
retrieving revision 1.19
diff -u -r1.19 once.cpp
--- libs/thread/src/once.cpp 17 Jul 2004 04:33:59 -0000 1.19
+++ libs/thread/src/once.cpp 3 Jul 2005 23:25:19 -0000
@@ -11,11 +11,17 @@
 
 #include <boost/thread/detail/config.hpp>
 
+#include <boost/detail/workaround.hpp>
+
 #include <boost/thread/once.hpp>
 #include <cstdio>
 #include <cassert>
 
+
 #if defined(BOOST_HAS_WINTHREADS)
+# if BOOST_WORKAROUND(__BORLANDC__,<= 0x551)
+ using std::size_t;
+# endif
 # include <windows.h>
 # if defined(BOOST_NO_STRINGSTREAM)
 # include <strstream>


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