Boost logo

Boost-Commit :

From: chris_at_[hidden]
Date: 2008-07-08 08:31:48


Author: chris_kohlhoff
Date: 2008-07-08 08:31:48 EDT (Tue, 08 Jul 2008)
New Revision: 47218
URL: http://svn.boost.org/trac/boost/changeset/47218

Log:
Fix SSL thread ID function to work correctly on 64-bit Windows.

Text files modified:
   trunk/boost/asio/ssl/detail/openssl_init.hpp | 7 +++++++
   1 files changed, 7 insertions(+), 0 deletions(-)

Modified: trunk/boost/asio/ssl/detail/openssl_init.hpp
==============================================================================
--- trunk/boost/asio/ssl/detail/openssl_init.hpp (original)
+++ trunk/boost/asio/ssl/detail/openssl_init.hpp 2008-07-08 08:31:48 EDT (Tue, 08 Jul 2008)
@@ -21,6 +21,7 @@
 #include <boost/asio/detail/push_options.hpp>
 #include <vector>
 #include <boost/assert.hpp>
+#include <boost/config.hpp>
 #include <boost/shared_ptr.hpp>
 #include <boost/asio/detail/pop_options.hpp>
 
@@ -87,11 +88,15 @@
   private:
     static unsigned long openssl_id_func()
     {
+#if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
+ return ::GetCurrentThreadId();
+#else // defined(BOOST_WINDOWS) || defined(__CYGWIN__)
       void* id = instance()->thread_id_;
       if (id == 0)
         instance()->thread_id_ = id = &id; // Ugh.
       BOOST_ASSERT(sizeof(unsigned long) >= sizeof(void*));
       return reinterpret_cast<unsigned long>(id);
+#endif // defined(BOOST_WINDOWS) || defined(__CYGWIN__)
     }
 
     static void openssl_locking_func(int mode, int n,
@@ -106,8 +111,10 @@
     // Mutexes to be used in locking callbacks.
     std::vector<boost::shared_ptr<boost::asio::detail::mutex> > mutexes_;
 
+#if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__)
     // The thread identifiers to be used by openssl.
     boost::asio::detail::tss_ptr<void> thread_id_;
+#endif // !defined(BOOST_WINDOWS) && !defined(__CYGWIN__)
   };
 
 public:


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