Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r86540 - trunk/boost/thread
From: vicente.botet_at_[hidden]
Date: 2013-11-01 17:08:01


Author: viboes
Date: 2013-11-01 17:08:00 EDT (Fri, 01 Nov 2013)
New Revision: 86540
URL: http://svn.boost.org/trac/boost/changeset/86540

Log:
Thread: unlock around the calls to continuations oe deferred future executions.

Text files modified:
   trunk/boost/thread/future.hpp | 24 ++++++++++++++++++++----
   1 files changed, 20 insertions(+), 4 deletions(-)

Modified: trunk/boost/thread/future.hpp
==============================================================================
--- trunk/boost/thread/future.hpp Fri Nov 1 15:52:10 2013 (r86539)
+++ trunk/boost/thread/future.hpp 2013-11-01 17:08:00 EDT (Fri, 01 Nov 2013) (r86540)
@@ -981,7 +981,11 @@
           virtual void execute(boost::unique_lock<boost::mutex>& lck) {
             try
             {
- this->mark_finished_with_result_internal(func_(), lck);
+ Fp local_fuct=boost::move(func_);
+ relocker relock(lck);
+ Rp res = local_fuct();
+ relock.lock();
+ this->mark_finished_with_result_internal(boost::move(res), lck);
             }
             catch (...)
             {
@@ -1030,7 +1034,10 @@
           virtual void execute(boost::unique_lock<boost::mutex>& lck) {
             try
             {
- func_();
+ Fp local_fuct=boost::move(func_);
+ relocker relock(lck);
+ local_fuct();
+ relock.lock();
               this->mark_finished_with_result_internal(lck);
             }
             catch (...)
@@ -4133,7 +4140,12 @@
       virtual void execute(boost::unique_lock<boost::mutex>& lck) {
         try
         {
- this->mark_finished_with_result_internal(continuation(boost::move(parent)), lck);
+ Fp local_fuct=boost::move(continuation);
+ F ftmp = boost::move(parent);
+ relocker relock(lck);
+ Rp res = local_fuct(boost::move(ftmp));
+ relock.lock();
+ this->mark_finished_with_result_internal(boost::move(res), lck);
         }
         catch (...)
         {
@@ -4165,7 +4177,11 @@
       virtual void execute(boost::unique_lock<boost::mutex>& lck) {
         try
         {
- continuation(boost::move(parent));
+ Fp local_fuct=boost::move(continuation);
+ F ftmp = boost::move(parent);
+ relocker relock(lck);
+ local_fuct(boost::move(ftmp));
+ relock.lock();
           this->mark_finished_with_result_internal(lck);
         }
         catch (...)


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