Boost logo

Boost-Commit :

From: anthony_at_[hidden]
Date: 2008-06-10 11:29:36


Author: anthonyw
Date: 2008-06-10 11:29:35 EDT (Tue, 10 Jun 2008)
New Revision: 46295
URL: http://svn.boost.org/trac/boost/changeset/46295

Log:
Correctly remove the reference type when copying the thread function into the thread data area so we don't end up with a dangling reference
Text files modified:
   trunk/boost/thread/detail/thread.hpp | 7 ++++++-
   1 files changed, 6 insertions(+), 1 deletions(-)

Modified: trunk/boost/thread/detail/thread.hpp
==============================================================================
--- trunk/boost/thread/detail/thread.hpp (original)
+++ trunk/boost/thread/detail/thread.hpp 2008-06-10 11:29:35 EDT (Tue, 10 Jun 2008)
@@ -21,6 +21,7 @@
 #include <stdlib.h>
 #include <memory>
 #include <boost/utility/enable_if.hpp>
+#include <boost/type_traits/remove_reference.hpp>
 
 #include <boost/config/abi_prefix.hpp>
 
@@ -122,7 +123,11 @@
         template<typename F>
         static inline detail::thread_data_ptr make_thread_info(F&& f)
         {
- return detail::thread_data_ptr(detail::heap_new<detail::thread_data<F> >(static_cast<F&&>(f)));
+ return detail::thread_data_ptr(detail::heap_new<detail::thread_data<typename boost::remove_reference<F>::type> >(static_cast<F&&>(f)));
+ }
+ static inline detail::thread_data_ptr make_thread_info(void (*f)())
+ {
+ return detail::thread_data_ptr(detail::heap_new<detail::thread_data<void(*)()> >(f));
         }
 #else
         template<typename F>


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