Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r75799 - in trunk/boost/thread: . detail pthread win32
From: vicente.botet_at_[hidden]
Date: 2011-12-04 05:36:36


Author: viboes
Date: 2011-12-04 05:36:34 EST (Sun, 04 Dec 2011)
New Revision: 75799
URL: http://svn.boost.org/trac/boost/changeset/75799

Log:
Thread: #2309 - Lack of g++ symbol visibility support in Boost.Thread
Text files modified:
   trunk/boost/thread/detail/config.hpp | 10 ++++++++--
   trunk/boost/thread/detail/thread.hpp | 13 ++++++++-----
   trunk/boost/thread/exceptions.hpp | 16 ++++++++--------
   trunk/boost/thread/pthread/thread_data.hpp | 2 +-
   trunk/boost/thread/win32/thread_data.hpp | 12 ++++++------
   5 files changed, 31 insertions(+), 22 deletions(-)

Modified: trunk/boost/thread/detail/config.hpp
==============================================================================
--- trunk/boost/thread/detail/config.hpp (original)
+++ trunk/boost/thread/detail/config.hpp 2011-12-04 05:36:34 EST (Sun, 04 Dec 2011)
@@ -53,12 +53,18 @@
 
 #if defined(BOOST_HAS_DECLSPEC)
 # if defined(BOOST_THREAD_BUILD_DLL) //Build dll
-# define BOOST_THREAD_DECL __declspec(dllexport)
+# define BOOST_THREAD_DECL BOOST_SYMBOL_EXPORT
+//# define BOOST_THREAD_DECL __declspec(dllexport)
+
 # elif defined(BOOST_THREAD_USE_DLL) //Use dll
-# define BOOST_THREAD_DECL __declspec(dllimport)
+# define BOOST_THREAD_DECL BOOST_SYMBOL_IMPORT
+//# define BOOST_THREAD_DECL __declspec(dllimport)
 # else
 # define BOOST_THREAD_DECL
 # endif
+#elif (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
+# define BOOST_THREAD_DECL BOOST_SYMBOL_VISIBLE
+
 #else
 # define BOOST_THREAD_DECL
 #endif // BOOST_HAS_DECLSPEC

Modified: trunk/boost/thread/detail/thread.hpp
==============================================================================
--- trunk/boost/thread/detail/thread.hpp (original)
+++ trunk/boost/thread/detail/thread.hpp 2011-12-04 05:36:34 EST (Sun, 04 Dec 2011)
@@ -312,7 +312,7 @@
             thread_info.swap(x.thread_info);
         }
 
- class id;
+ class BOOST_SYMBOL_VISIBLE id;
         id get_id() const;
 
 
@@ -380,13 +380,13 @@
         bool BOOST_THREAD_DECL interruption_enabled();
         bool BOOST_THREAD_DECL interruption_requested();
 
- inline void sleep(xtime const& abs_time)
+ inline BOOST_SYMBOL_VISIBLE void sleep(xtime const& abs_time)
         {
             sleep(system_time(abs_time));
         }
     }
 
- class thread::id
+ class BOOST_SYMBOL_VISIBLE thread::id
     {
     private:
         detail::thread_data_ptr thread_data;
@@ -434,7 +434,8 @@
 #ifndef BOOST_NO_IOSTREAM
 #ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
         template<class charT, class traits>
- friend std::basic_ostream<charT, traits>&
+ friend BOOST_SYMBOL_VISIBLE
+ std::basic_ostream<charT, traits>&
         operator<<(std::basic_ostream<charT, traits>& os, const id& x)
         {
             if(x.thread_data)
@@ -448,7 +449,8 @@
         }
 #else
         template<class charT, class traits>
- std::basic_ostream<charT, traits>&
+ BOOST_SYMBOL_VISIBLE
+ std::basic_ostream<charT, traits>&
         print(std::basic_ostream<charT, traits>& os) const
         {
             if(thread_data)
@@ -467,6 +469,7 @@
 
 #if !defined(BOOST_NO_IOSTREAM) && defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
     template<class charT, class traits>
+ BOOST_SYMBOL_VISIBLE
     std::basic_ostream<charT, traits>&
     operator<<(std::basic_ostream<charT, traits>& os, const thread::id& x)
     {

Modified: trunk/boost/thread/exceptions.hpp
==============================================================================
--- trunk/boost/thread/exceptions.hpp (original)
+++ trunk/boost/thread/exceptions.hpp 2011-12-04 05:36:34 EST (Sun, 04 Dec 2011)
@@ -24,10 +24,10 @@
 namespace boost
 {
 
- class thread_interrupted
+ class BOOST_SYMBOL_VISIBLE thread_interrupted
     {};
 
- class thread_exception:
+ class BOOST_SYMBOL_VISIBLE thread_exception:
         public std::exception
     {
     protected:
@@ -55,7 +55,7 @@
         int m_sys_err;
     };
 
- class condition_error:
+ class BOOST_SYMBOL_VISIBLE condition_error:
         public std::exception
     {
     public:
@@ -66,7 +66,7 @@
     };
     
 
- class lock_error:
+ class BOOST_SYMBOL_VISIBLE lock_error:
         public thread_exception
     {
     public:
@@ -87,7 +87,7 @@
         }
     };
 
- class thread_resource_error:
+ class BOOST_SYMBOL_VISIBLE thread_resource_error:
         public thread_exception
     {
     public:
@@ -109,7 +109,7 @@
     
     };
 
- class unsupported_thread_option:
+ class BOOST_SYMBOL_VISIBLE unsupported_thread_option:
         public thread_exception
     {
     public:
@@ -131,7 +131,7 @@
     
     };
 
- class invalid_thread_argument:
+ class BOOST_SYMBOL_VISIBLE invalid_thread_argument:
         public thread_exception
     {
     public:
@@ -153,7 +153,7 @@
     
     };
 
- class thread_permission_error:
+ class BOOST_SYMBOL_VISIBLE thread_permission_error:
         public thread_exception
     {
     public:

Modified: trunk/boost/thread/pthread/thread_data.hpp
==============================================================================
--- trunk/boost/thread/pthread/thread_data.hpp (original)
+++ trunk/boost/thread/pthread/thread_data.hpp 2011-12-04 05:36:34 EST (Sun, 04 Dec 2011)
@@ -144,7 +144,7 @@
         void BOOST_THREAD_DECL sleep(system_time const& abs_time);
 
         template<typename TimeDuration>
- inline void sleep(TimeDuration const& rel_time)
+ inline BOOST_SYMBOL_VISIBLE void sleep(TimeDuration const& rel_time)
         {
             this_thread::sleep(get_system_time()+rel_time);
         }

Modified: trunk/boost/thread/win32/thread_data.hpp
==============================================================================
--- trunk/boost/thread/win32/thread_data.hpp (original)
+++ trunk/boost/thread/win32/thread_data.hpp 2011-12-04 05:36:34 EST (Sun, 04 Dec 2011)
@@ -24,7 +24,7 @@
         void intrusive_ptr_add_ref(thread_data_base * p);
         void intrusive_ptr_release(thread_data_base * p);
         
- struct thread_data_base
+ struct BOOST_SYMBOL_VISIBLE thread_data_base
         {
             long count;
             detail::win32::handle_manager thread_handle;
@@ -69,7 +69,7 @@
 
         typedef boost::intrusive_ptr<detail::thread_data_base> thread_data_ptr;
 
- struct timeout
+ struct BOOST_SYMBOL_VISIBLE timeout
         {
             unsigned long start;
             uintmax_t milliseconds;
@@ -92,7 +92,7 @@
                 abs_time(abs_time_)
             {}
 
- struct remaining_time
+ struct BOOST_SYMBOL_VISIBLE remaining_time
             {
                 bool more;
                 unsigned long milliseconds;
@@ -160,17 +160,17 @@
         {
             interruptible_wait(detail::win32::invalid_handle_value,milliseconds);
         }
- inline void interruptible_wait(system_time const& abs_time)
+ inline BOOST_SYMBOL_VISIBLE void interruptible_wait(system_time const& abs_time)
         {
             interruptible_wait(detail::win32::invalid_handle_value,abs_time);
         }
 
         template<typename TimeDuration>
- inline void sleep(TimeDuration const& rel_time)
+ inline BOOST_SYMBOL_VISIBLE void sleep(TimeDuration const& rel_time)
         {
             interruptible_wait(detail::pin_to_zero(rel_time.total_milliseconds()));
         }
- inline void sleep(system_time const& abs_time)
+ inline BOOST_SYMBOL_VISIBLE void sleep(system_time const& abs_time)
         {
             interruptible_wait(abs_time);
         }


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