Convert __thread_local_data to the singleton pattern
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116500 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -677,7 +677,7 @@ __assoc_state<_R>::set_value_at_thread_exit(_Arg& __arg)
|
||||
throw future_error(make_error_code(future_errc::promise_already_satisfied));
|
||||
::new(&__value_) _R(_STD::forward<_Arg>(__arg));
|
||||
this->__state_ |= base::__constructed;
|
||||
__thread_local_data->__make_ready_at_thread_exit(this);
|
||||
__thread_local_data()->__make_ready_at_thread_exit(this);
|
||||
__lk.unlock();
|
||||
}
|
||||
|
||||
@@ -750,7 +750,7 @@ __assoc_state<_R&>::set_value_at_thread_exit(_R& __arg)
|
||||
throw future_error(make_error_code(future_errc::promise_already_satisfied));
|
||||
__value_ = &__arg;
|
||||
this->__state_ |= base::__constructed;
|
||||
__thread_local_data->__make_ready_at_thread_exit(this);
|
||||
__thread_local_data()->__make_ready_at_thread_exit(this);
|
||||
__lk.unlock();
|
||||
}
|
||||
|
||||
|
@@ -318,13 +318,13 @@ public:
|
||||
void __make_ready_at_thread_exit(__assoc_sub_state*);
|
||||
};
|
||||
|
||||
extern __thread_specific_ptr<__thread_struct> __thread_local_data;
|
||||
__thread_specific_ptr<__thread_struct>& __thread_local_data();
|
||||
|
||||
template <class _F>
|
||||
void*
|
||||
__thread_proxy(void* __vp)
|
||||
{
|
||||
__thread_local_data.reset(new __thread_struct);
|
||||
__thread_local_data().reset(new __thread_struct);
|
||||
std::unique_ptr<_F> __p(static_cast<_F*>(__vp));
|
||||
(*__p)();
|
||||
return nullptr;
|
||||
|
Reference in New Issue
Block a user