Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r85962 - trunk/boost/thread
From: vicente.botet_at_[hidden]
Date: 2013-09-26 10:47:24


Author: viboes
Date: 2013-09-26 10:47:24 EDT (Thu, 26 Sep 2013)
New Revision: 85962
URL: http://svn.boost.org/trac/boost/changeset/85962

Log:
Thread: future::then should join the thread before destruction.

Text files modified:
   trunk/boost/thread/future.hpp | 18 +++++++++++++++---
   1 files changed, 15 insertions(+), 3 deletions(-)

Modified: trunk/boost/thread/future.hpp
==============================================================================
--- trunk/boost/thread/future.hpp Thu Sep 26 10:10:37 2013 (r85961)
+++ trunk/boost/thread/future.hpp 2013-09-26 10:47:24 EDT (Thu, 26 Sep 2013) (r85962)
@@ -821,8 +821,12 @@
         struct future_async_shared_state_base: shared_state<Rp>
         {
           typedef shared_state<Rp> base_type;
+ protected:
           boost::thread thr_;
-
+ void join()
+ {
+ if (thr_.joinable()) thr_.join();
+ }
         public:
           future_async_shared_state_base()
           {
@@ -836,12 +840,12 @@
 
           ~future_async_shared_state_base()
           {
- if (thr_.joinable()) thr_.join();
+ join();
           }
 
           virtual void wait(bool rethrow)
           {
- if (thr_.joinable()) thr_.join();
+ join();
               this->base_type::wait(rethrow);
           }
         };
@@ -3769,6 +3773,10 @@
           that->mark_exceptional_finish();
         }
       }
+ ~future_async_continuation_shared_state()
+ {
+ this->join();
+ }
     };
 
     template<typename F, typename Fp>
@@ -3810,6 +3818,10 @@
           that->mark_exceptional_finish();
         }
       }
+ ~future_async_continuation_shared_state()
+ {
+ this->join();
+ }
     };
 
 


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