Boost logo

Boost-Commit :

From: anthony_at_[hidden]
Date: 2007-11-26 10:44:08


Author: anthonyw
Date: 2007-11-26 10:44:07 EST (Mon, 26 Nov 2007)
New Revision: 41398
URL: http://svn.boost.org/trac/boost/changeset/41398

Log:
fixed import/export declarations so new once code works with pthread-win32
Text files modified:
   trunk/boost/thread/detail/config.hpp | 5 ++---
   trunk/boost/thread/pthread/condition_variable.hpp | 6 ++++++
   trunk/boost/thread/pthread/condition_variable_fwd.hpp | 6 ++++++
   trunk/boost/thread/pthread/once.hpp | 6 +++---
   trunk/boost/thread/win32/condition_variable.hpp | 11 +++++++++++
   trunk/libs/thread/build/Jamfile.v2 | 5 ++++-
   trunk/libs/thread/src/pthread/once.cpp | 7 +++----
   trunk/libs/thread/test/test_once.cpp | 1 +
   8 files changed, 36 insertions(+), 11 deletions(-)

Modified: trunk/boost/thread/detail/config.hpp
==============================================================================
--- trunk/boost/thread/detail/config.hpp (original)
+++ trunk/boost/thread/detail/config.hpp 2007-11-26 10:44:07 EST (Mon, 26 Nov 2007)
@@ -17,8 +17,7 @@
 # pragma warn -8066 // Unreachable code
 #endif
 
-// insist on threading support being available:
-#include <boost/config/requires_threads.hpp>
+#include "platform.hpp"
 
 // compatibility with the rest of Boost's auto-linking code:
 #if defined(BOOST_THREAD_DYN_DLL) || defined(BOOST_ALL_DYN_LINK)
@@ -31,7 +30,7 @@
 #elif defined(BOOST_THREAD_USE_DLL) //Use dll
 #elif defined(BOOST_THREAD_USE_LIB) //Use lib
 #else //Use default
-# if defined(BOOST_HAS_WINTHREADS)
+# if defined(BOOST_THREAD_PLATFORM_WIN32)
 # if defined(BOOST_MSVC) || defined(BOOST_INTEL_WIN)
             //For compilers supporting auto-tss cleanup
             //with Boost.Threads lib, use Boost.Threads lib

Modified: trunk/boost/thread/pthread/condition_variable.hpp
==============================================================================
--- trunk/boost/thread/pthread/condition_variable.hpp (original)
+++ trunk/boost/thread/pthread/condition_variable.hpp 2007-11-26 10:44:07 EST (Mon, 26 Nov 2007)
@@ -150,6 +150,12 @@
             return true;
         }
 
+ template<typename lock_type,typename duration_type,typename predicate_type>
+ bool timed_wait(lock_type& m,duration_type const& wait_duration,predicate_type pred)
+ {
+ return timed_wait(m,get_system_time()+wait_duration,pred);
+ }
+
         void notify_one()
         {
             boost::pthread::pthread_mutex_scoped_lock internal_lock(&internal_mutex);

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 2007-11-26 10:44:07 EST (Mon, 26 Nov 2007)
@@ -44,6 +44,12 @@
             return true;
         }
 
+ template<typename duration_type,typename predicate_type>
+ bool timed_wait(unique_lock<mutex>& m,duration_type const& wait_duration,predicate_type pred)
+ {
+ return timed_wait(m,get_system_time()+wait_duration,pred);
+ }
+
         void notify_one();
         void notify_all();
     };

Modified: trunk/boost/thread/pthread/once.hpp
==============================================================================
--- trunk/boost/thread/pthread/once.hpp (original)
+++ trunk/boost/thread/pthread/once.hpp 2007-11-26 10:44:07 EST (Mon, 26 Nov 2007)
@@ -27,9 +27,9 @@
     namespace detail
     {
         BOOST_THREAD_DECL boost::uintmax_t& get_once_per_thread_epoch();
- extern BOOST_THREAD_DECL boost::uintmax_t once_global_epoch;
- extern BOOST_THREAD_DECL pthread_mutex_t once_epoch_mutex;
- extern BOOST_THREAD_DECL pthread_cond_t once_epoch_cv;
+ BOOST_THREAD_DECL extern boost::uintmax_t once_global_epoch;
+ BOOST_THREAD_DECL extern pthread_mutex_t once_epoch_mutex;
+ BOOST_THREAD_DECL extern pthread_cond_t once_epoch_cv;
     }
     
 #define BOOST_ONCE_INITIAL_FLAG_VALUE -1

Modified: trunk/boost/thread/win32/condition_variable.hpp
==============================================================================
--- trunk/boost/thread/win32/condition_variable.hpp (original)
+++ trunk/boost/thread/win32/condition_variable.hpp 2007-11-26 10:44:07 EST (Mon, 26 Nov 2007)
@@ -263,6 +263,11 @@
             }
             return true;
         }
+ template<typename duration_type,typename predicate_type>
+ bool timed_wait(unique_lock<mutex>& m,duration_type const& wait_duration,predicate_type pred)
+ {
+ return timed_wait(m,get_system_time()+wait_duration,pred);
+ }
     };
     
     class condition_variable_any:
@@ -297,6 +302,12 @@
             }
             return true;
         }
+
+ template<typename lock_type,typename duration_type,typename predicate_type>
+ bool timed_wait(lock_type& m,duration_type const& wait_duration,predicate_type pred)
+ {
+ return timed_wait(m,get_system_time()+wait_duration,pred);
+ }
     };
 
 }

Modified: trunk/libs/thread/build/Jamfile.v2
==============================================================================
--- trunk/libs/thread/build/Jamfile.v2 (original)
+++ trunk/libs/thread/build/Jamfile.v2 2007-11-26 10:44:07 EST (Mon, 26 Nov 2007)
@@ -157,6 +157,7 @@
 rule requirements ( properties * )
 {
     local result ;
+
     if <threadapi>pthread in $(properties)
     {
         result += <define>BOOST_THREAD_POSIX ;
@@ -201,5 +202,7 @@
     : thread_sources
     : <conditional>@requirements
     :
- : <conditional>@usage-requirements
+ : <link>shared:<define>BOOST_THREAD_USE_DLL=1
+ <link>static:<define>BOOST_THREAD_USE_LIB=1
+ <conditional>@usage-requirements
     ;

Modified: trunk/libs/thread/src/pthread/once.cpp
==============================================================================
--- trunk/libs/thread/src/pthread/once.cpp (original)
+++ trunk/libs/thread/src/pthread/once.cpp 2007-11-26 10:44:07 EST (Mon, 26 Nov 2007)
@@ -12,9 +12,9 @@
 {
     namespace detail
     {
- boost::uintmax_t once_global_epoch=0;
- pthread_mutex_t once_epoch_mutex=PTHREAD_MUTEX_INITIALIZER;
- pthread_cond_t once_epoch_cv = PTHREAD_COND_INITIALIZER;
+ BOOST_THREAD_DECL boost::uintmax_t once_global_epoch=0;
+ BOOST_THREAD_DECL pthread_mutex_t once_epoch_mutex=PTHREAD_MUTEX_INITIALIZER;
+ BOOST_THREAD_DECL pthread_cond_t once_epoch_cv = PTHREAD_COND_INITIALIZER;
 
         namespace
         {
@@ -45,7 +45,6 @@
             }
             return *static_cast<boost::uintmax_t*>(data);
         }
-
     }
     
 }

Modified: trunk/libs/thread/test/test_once.cpp
==============================================================================
--- trunk/libs/thread/test/test_once.cpp (original)
+++ trunk/libs/thread/test/test_once.cpp 2007-11-26 10:44:07 EST (Mon, 26 Nov 2007)
@@ -19,6 +19,7 @@
     ++var_to_init;
 }
 
+
 void call_once_thread()
 {
     unsigned const loop_count=100;


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