summaryrefslogtreecommitdiffstats
path: root/libcxx/src
diff options
context:
space:
mode:
Diffstat (limited to 'libcxx/src')
-rw-r--r--libcxx/src/condition_variable.cpp2
-rw-r--r--libcxx/src/future.cpp4
-rw-r--r--libcxx/src/thread.cpp7
3 files changed, 9 insertions, 4 deletions
diff --git a/libcxx/src/condition_variable.cpp b/libcxx/src/condition_variable.cpp
index 3bafa8c8cb8..6727a022687 100644
--- a/libcxx/src/condition_variable.cpp
+++ b/libcxx/src/condition_variable.cpp
@@ -64,7 +64,7 @@ condition_variable::__do_timed_wait(unique_lock<mutex>& lk,
void
notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk)
{
- __thread_local_data->notify_all_at_thread_exit(&cond, lk.release());
+ __thread_local_data()->notify_all_at_thread_exit(&cond, lk.release());
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/src/future.cpp b/libcxx/src/future.cpp
index 29b58641315..f291fe53955 100644
--- a/libcxx/src/future.cpp
+++ b/libcxx/src/future.cpp
@@ -83,7 +83,7 @@ __assoc_sub_state::set_value_at_thread_exit()
if (__has_value())
throw future_error(make_error_code(future_errc::promise_already_satisfied));
__state_ |= __constructed;
- __thread_local_data->__make_ready_at_thread_exit(this);
+ __thread_local_data()->__make_ready_at_thread_exit(this);
__lk.unlock();
}
@@ -106,7 +106,7 @@ __assoc_sub_state::set_exception_at_thread_exit(exception_ptr __p)
if (__has_value())
throw future_error(make_error_code(future_errc::promise_already_satisfied));
__exception_ = __p;
- __thread_local_data->__make_ready_at_thread_exit(this);
+ __thread_local_data()->__make_ready_at_thread_exit(this);
__lk.unlock();
}
diff --git a/libcxx/src/thread.cpp b/libcxx/src/thread.cpp
index 3d388e9f030..aa075133a31 100644
--- a/libcxx/src/thread.cpp
+++ b/libcxx/src/thread.cpp
@@ -83,7 +83,12 @@ sleep_for(const chrono::nanoseconds& ns)
} // this_thread
-__thread_specific_ptr<__thread_struct> __thread_local_data;
+__thread_specific_ptr<__thread_struct>&
+__thread_local_data()
+{
+ static __thread_specific_ptr<__thread_struct> __p;
+ return __p;
+}
// __thread_struct_imp
OpenPOWER on IntegriCloud