Opened 9 years ago

Closed 9 years ago

#8671 closed Bugs (fixed)

promise: set_..._at_thread_exit

Reported by: viboes Owned by: viboes
Milestone: Boost 1.54.0 Component: thread
Version: Boost 1.53.0 Severity: Problem
Keywords: Cc:

Description

~promise needs to check if the promise shared state will be set at thread exit and set_exception_and_thread_exit needs to set this state.

Index: future.hpp
===================================================================
--- future.hpp	(revision 84678)
+++ future.hpp	(working copy)
@@ -443,6 +443,7 @@
                   throw_exception(promise_already_satisfied());
               }
               exception=e;
+              this->is_constructed = true;
               get_current_thread_data()->make_ready_at_thread_exit(shared_from_this());
             }
             bool has_value()
@@ -1746,7 +1747,7 @@
             {
                 boost::unique_lock<boost::mutex> lock(future_->mutex);
 
-                if(!future_->done)
+                if(!future_->done && !future_->is_constructed)
                 {
                     future_->mark_exceptional_finish_internal(boost::copy_exception(broken_promise()), lock);
                 }
@@ -1915,7 +1916,7 @@
             {
                 boost::unique_lock<boost::mutex> lock(future_->mutex);
 
-                if(!future_->done)
+                if(!future_->done && !future_->is_constructed)
                 {
                     future_->mark_exceptional_finish_internal(boost::copy_exception(broken_promise()), lock);
                 }
@@ -2057,7 +2058,7 @@
             {
                 boost::unique_lock<boost::mutex> lock(future_->mutex);
 
-                if(!future_->done)
+                if(!future_->done && !future_->is_constructed)
                 {
                     future_->mark_exceptional_finish_internal(boost::copy_exception(broken_promise()), lock);
                 }

Change History (2)

comment:1 by viboes, 9 years ago

Milestone: To Be DeterminedBoost 1.54.0
Owner: changed from Anthony Williams to viboes
Status: newassigned

comment:2 by viboes, 9 years ago

Resolution: fixed
Status: assignedclosed

(In [84717]) Thread: fix #8550, #8671, #8672.

Note: See TracTickets for help on using tickets.