[futures.atomic_future] and notify_all_at_thread_exit. This completes the header <future> and all of Chapter 30 (for C++0x enabled compilers).
llvm-svn: 113017
Cr-Mirrored-From: sso://chromium.googlesource.com/_direct/external/github.com/llvm/llvm-project
Cr-Mirrored-Commit: b77c0c03bb5f48c7ff98aa0d8dd5c648e8a1a651
diff --git a/src/future.cpp b/src/future.cpp
index 924a684..ca30803 100644
--- a/src/future.cpp
+++ b/src/future.cpp
@@ -257,4 +257,39 @@
return *this;
}
+atomic_future<void>::~atomic_future()
+{
+ if (__state_)
+ __state_->__release_shared();
+}
+
+atomic_future<void>&
+atomic_future<void>::operator=(const atomic_future& __rhs)
+{
+ if (this != &__rhs)
+ {
+ unique_lock<mutex> __this(__mut_, defer_lock);
+ unique_lock<mutex> __that(__rhs.__mut_, defer_lock);
+ _STD::lock(__this, __that);
+ if (__rhs.__state_)
+ __rhs.__state_->__add_shared();
+ if (__state_)
+ __state_->__release_shared();
+ __state_ = __rhs.__state_;
+ }
+ return *this;
+}
+
+void
+atomic_future<void>::swap(atomic_future& __rhs)
+{
+ if (this != &__rhs)
+ {
+ unique_lock<mutex> __this(__mut_, defer_lock);
+ unique_lock<mutex> __that(__rhs.__mut_, defer_lock);
+ _STD::lock(__this, __that);
+ _STD::swap(__state_, __rhs.__state_);
+ }
+}
+
_LIBCPP_END_NAMESPACE_STD