[futures.atomic_future] and notify_all_at_thread_exit. This completes the header <future> and all of Chapter 30 (for C++0x enabled compilers).
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@113017 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -257,4 +257,39 @@ shared_future<void>::operator=(const shared_future& __rhs)
|
||||
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
|
||||
|
Reference in New Issue
Block a user