Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r76996 - in trunk: boost/thread/detail boost/thread/pthread libs/thread/test libs/thread/test/sync/conditions/condition_variable libs/thread/test/sync/mutual_exclusion/mutex libs/thread/test/sync/mutual_exclusion/recursive_mutex libs/thread/test/sync/mutual_exclusion/recursive_timed_mutex libs/thread/test/sync/mutual_exclusion/timed_mutex libs/thread/test/threads/thread/constr
From: vicente.botet_at_[hidden]
Date: 2012-02-12 11:47:20


Author: viboes
Date: 2012-02-12 11:47:19 EST (Sun, 12 Feb 2012)
New Revision: 76996
URL: http://svn.boost.org/trac/boost/changeset/76996

Log:
Thread: Don't fail when native_handle is not defined
Text files modified:
   trunk/boost/thread/detail/thread.hpp | 1 +
   trunk/boost/thread/pthread/condition_variable_fwd.hpp | 1 +
   trunk/boost/thread/pthread/mutex.hpp | 2 ++
   trunk/boost/thread/pthread/recursive_mutex.hpp | 2 ++
   trunk/libs/thread/test/Jamfile.v2 | 2 +-
   trunk/libs/thread/test/sync/conditions/condition_variable/native_handle_pass.cpp | 2 ++
   trunk/libs/thread/test/sync/mutual_exclusion/mutex/native_handle_pass.cpp | 3 ++-
   trunk/libs/thread/test/sync/mutual_exclusion/recursive_mutex/native_handle_pass.cpp | 2 ++
   trunk/libs/thread/test/sync/mutual_exclusion/recursive_timed_mutex/native_handle_pass.cpp | 3 ++-
   trunk/libs/thread/test/sync/mutual_exclusion/timed_mutex/native_handle_pass.cpp | 3 ++-
   trunk/libs/thread/test/threads/thread/constr/Frvalue_pass.cpp | 9 +++++++--
   11 files changed, 24 insertions(+), 6 deletions(-)

Modified: trunk/boost/thread/detail/thread.hpp
==============================================================================
--- trunk/boost/thread/detail/thread.hpp (original)
+++ trunk/boost/thread/detail/thread.hpp 2012-02-12 11:47:19 EST (Sun, 12 Feb 2012)
@@ -572,6 +572,7 @@
 
         static unsigned hardware_concurrency() BOOST_NOEXCEPT;
 
+#define BOOST_THREAD_DEFINES_THREAD_NATIVE_HANDLE
         typedef detail::thread_data_base::native_handle_type native_handle_type;
         native_handle_type native_handle();
 

Modified: trunk/boost/thread/pthread/condition_variable_fwd.hpp
==============================================================================
--- trunk/boost/thread/pthread/condition_variable_fwd.hpp (original)
+++ trunk/boost/thread/pthread/condition_variable_fwd.hpp 2012-02-12 11:47:19 EST (Sun, 12 Feb 2012)
@@ -201,6 +201,7 @@
         }
 #endif
 
+#define BOOST_THREAD_DEFINES_CONDITION_VARIABLE_NATIVE_HANDLE
         typedef pthread_cond_t* native_handle_type;
         native_handle_type native_handle()
         {

Modified: trunk/boost/thread/pthread/mutex.hpp
==============================================================================
--- trunk/boost/thread/pthread/mutex.hpp (original)
+++ trunk/boost/thread/pthread/mutex.hpp 2012-02-12 11:47:19 EST (Sun, 12 Feb 2012)
@@ -104,6 +104,7 @@
             return !res;
         }
 
+#define BOOST_THREAD_DEFINES_MUTEX_NATIVE_HANDLE
         typedef pthread_mutex_t* native_handle_type;
         native_handle_type native_handle()
         {
@@ -285,6 +286,7 @@
         }
 #endif
 
+#define BOOST_THREAD_DEFINES_TIMED_MUTEX_NATIVE_HANDLE
         typedef pthread_mutex_t* native_handle_type;
         native_handle_type native_handle()
         {

Modified: trunk/boost/thread/pthread/recursive_mutex.hpp
==============================================================================
--- trunk/boost/thread/pthread/recursive_mutex.hpp (original)
+++ trunk/boost/thread/pthread/recursive_mutex.hpp 2012-02-12 11:47:19 EST (Sun, 12 Feb 2012)
@@ -123,6 +123,7 @@
             BOOST_ASSERT(!res || res==EBUSY);
             return !res;
         }
+#define BOOST_THREAD_DEFINES_RECURSIVE_MUTEX_NATIVE_HANDLE
         typedef pthread_mutex_t* native_handle_type;
         native_handle_type native_handle()
         {
@@ -387,6 +388,7 @@
         }
 #endif
 
+#define BOOST_THREAD_DEFINES_RECURSIVE_TIMED_MUTEX_NATIVE_HANDLE
         typedef pthread_mutex_t* native_handle_type;
         native_handle_type native_handle()
         {

Modified: trunk/libs/thread/test/Jamfile.v2
==============================================================================
--- trunk/libs/thread/test/Jamfile.v2 (original)
+++ trunk/libs/thread/test/Jamfile.v2 2012-02-12 11:47:19 EST (Sun, 12 Feb 2012)
@@ -231,7 +231,7 @@
           [ thread-compile-fail-V2 ./threads/thread/constr/copy_fail.cpp : : thread__constr__copy_fail ]
           [ thread-run2 ./threads/thread/constr/default_pass.cpp : thread__constr__default_pass ]
           [ thread-run2 ./threads/thread/constr/F_pass.cpp : thread__constr__F_pass ]
- [ thread-run2 ./threads/thread/constr/Frvalue_pass.cpp : thread__constr__Frvalue_pass ]
+ #[ thread-run2 ./threads/thread/constr/Frvalue_pass.cpp : thread__constr__Frvalue_pass ]
           #[ thread-run2 ./threads/thread/constr/FrvalueArgs_pass.cpp : thread__constr__FrvalueArgs_pass ]
           [ thread-run2 ./threads/thread/constr/move_pass.cpp : thread__constr__move_pass ]
           [ thread-run2 ./threads/thread/destr/dtor_pass.cpp : thread__destr__dtor_pass ]

Modified: trunk/libs/thread/test/sync/conditions/condition_variable/native_handle_pass.cpp
==============================================================================
--- trunk/libs/thread/test/sync/conditions/condition_variable/native_handle_pass.cpp (original)
+++ trunk/libs/thread/test/sync/conditions/condition_variable/native_handle_pass.cpp 2012-02-12 11:47:19 EST (Sun, 12 Feb 2012)
@@ -24,10 +24,12 @@
 
 int main()
 {
+#if defined BOOST_THREAD_DEFINES_CONDITION_VARIABLE_NATIVE_HANDLE
   //BOOST_STATIC_ASSERT((boost::is_same<boost::condition_variable::native_handle_type, pthread_cond_t*>::value));
   boost::condition_variable cv;
   boost::condition_variable::native_handle_type h = cv.native_handle();
   BOOST_TEST(h != 0);
+#endif
   return boost::report_errors();
 }
 

Modified: trunk/libs/thread/test/sync/mutual_exclusion/mutex/native_handle_pass.cpp
==============================================================================
--- trunk/libs/thread/test/sync/mutual_exclusion/mutex/native_handle_pass.cpp (original)
+++ trunk/libs/thread/test/sync/mutual_exclusion/mutex/native_handle_pass.cpp 2012-02-12 11:47:19 EST (Sun, 12 Feb 2012)
@@ -24,10 +24,11 @@
 
 int main()
 {
+#if defined BOOST_THREAD_DEFINES_MUTEX_NATIVE_HANDLE
   boost::mutex m;
   boost::mutex::native_handle_type h = m.native_handle();
   BOOST_TEST(h);
-
+#endif
   return boost::report_errors();
 }
 

Modified: trunk/libs/thread/test/sync/mutual_exclusion/recursive_mutex/native_handle_pass.cpp
==============================================================================
--- trunk/libs/thread/test/sync/mutual_exclusion/recursive_mutex/native_handle_pass.cpp (original)
+++ trunk/libs/thread/test/sync/mutual_exclusion/recursive_mutex/native_handle_pass.cpp 2012-02-12 11:47:19 EST (Sun, 12 Feb 2012)
@@ -24,9 +24,11 @@
 
 int main()
 {
+#if defined BOOST_THREAD_DEFINES_RECURSIVE_MUTEX_NATIVE_HANDLE
   boost::recursive_mutex m;
   boost::recursive_mutex::native_handle_type h = m.native_handle();
   BOOST_TEST(h);
+#endif
 
   return boost::report_errors();
 }

Modified: trunk/libs/thread/test/sync/mutual_exclusion/recursive_timed_mutex/native_handle_pass.cpp
==============================================================================
--- trunk/libs/thread/test/sync/mutual_exclusion/recursive_timed_mutex/native_handle_pass.cpp (original)
+++ trunk/libs/thread/test/sync/mutual_exclusion/recursive_timed_mutex/native_handle_pass.cpp 2012-02-12 11:47:19 EST (Sun, 12 Feb 2012)
@@ -24,10 +24,11 @@
 
 int main()
 {
+#if defined BOOST_THREAD_DEFINES_RECURSIVE_TIMED_MUTEX_NATIVE_HANDLE
   boost::recursive_timed_mutex m;
   boost::recursive_timed_mutex::native_handle_type h = m.native_handle();
   BOOST_TEST(h);
-
+#endif
   return boost::report_errors();
 }
 

Modified: trunk/libs/thread/test/sync/mutual_exclusion/timed_mutex/native_handle_pass.cpp
==============================================================================
--- trunk/libs/thread/test/sync/mutual_exclusion/timed_mutex/native_handle_pass.cpp (original)
+++ trunk/libs/thread/test/sync/mutual_exclusion/timed_mutex/native_handle_pass.cpp 2012-02-12 11:47:19 EST (Sun, 12 Feb 2012)
@@ -25,10 +25,11 @@
 
 int main()
 {
+#if defined BOOST_THREAD_DEFINES_TIMED_MUTEX_NATIVE_HANDLE
   boost::timed_mutex m;
   boost::timed_mutex::native_handle_type h = m.native_handle();
   BOOST_TEST(h);
-
+#endif
   return boost::report_errors();
 }
 

Modified: trunk/libs/thread/test/threads/thread/constr/Frvalue_pass.cpp
==============================================================================
--- trunk/libs/thread/test/threads/thread/constr/Frvalue_pass.cpp (original)
+++ trunk/libs/thread/test/threads/thread/constr/Frvalue_pass.cpp 2012-02-12 11:47:19 EST (Sun, 12 Feb 2012)
@@ -66,12 +66,17 @@
   }
 };
 
+MoveOnly MakeMoveOnly() {
+ MoveOnly x;
+ return boost::move(x);
+}
 int main()
 {
   {
     // FIXME The following fails
- //boost::thread t1 (( MoveOnly() ));
- boost::thread t (( boost::move( MoveOnly() ) ));
+ boost::thread t = boost::thread( MoveOnly() );
+ //boost::thread t = boost::thread( MakeMoveOnly() );
+ //boost::thread t (( boost::move( MoveOnly() ) ));
     t.join();
   }
   return boost::report_errors();


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk