summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libcxx/include/future6
-rw-r--r--libcxx/src/future.cpp2
2 files changed, 6 insertions, 2 deletions
diff --git a/libcxx/include/future b/libcxx/include/future
index cf552a9f303..f4e6fec4f6c 100644
--- a/libcxx/include/future
+++ b/libcxx/include/future
@@ -470,7 +470,11 @@ public:
{return (__state_ & __constructed) || (__exception_ != nullptr);}
_LIBCPP_INLINE_VISIBILITY
- void __set_future_attached() {__state_ |= __future_attached;}
+ void __set_future_attached()
+ {
+ lock_guard<mutex> __lk(__mut_);
+ __state_ |= __future_attached;
+ }
_LIBCPP_INLINE_VISIBILITY
bool __has_future_attached() const {return __state_ & __future_attached;}
diff --git a/libcxx/src/future.cpp b/libcxx/src/future.cpp
index feb37e42db4..7d9a5b5da69 100644
--- a/libcxx/src/future.cpp
+++ b/libcxx/src/future.cpp
@@ -78,8 +78,8 @@ __assoc_sub_state::set_value()
throw future_error(make_error_code(future_errc::promise_already_satisfied));
#endif
__state_ |= __constructed | ready;
- __lk.unlock();
__cv_.notify_all();
+ __lk.unlock();
}
void
OpenPOWER on IntegriCloud