From 53a420fba21cf1644972b34dcd811a43cdb8368d Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Mon, 2 Jan 2017 19:18:58 +0000 Subject: Vendor import of libc++ trunk r290819: https://llvm.org/svn/llvm-project/libcxx/trunk@290819 --- src/condition_variable.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/condition_variable.cpp') diff --git a/src/condition_variable.cpp b/src/condition_variable.cpp index bfb4bf3925f7..25e66038eec0 100644 --- a/src/condition_variable.cpp +++ b/src/condition_variable.cpp @@ -79,6 +79,12 @@ condition_variable::__do_timed_wait(unique_lock& lk, void notify_all_at_thread_exit(condition_variable& cond, unique_lock lk) { + auto& tl_ptr = __thread_local_data(); + // If this thread was not created using std::thread then it will not have + // previously allocated. + if (tl_ptr.get() == nullptr) { + tl_ptr.set_pointer(new __thread_struct); + } __thread_local_data()->notify_all_at_thread_exit(&cond, lk.release()); } -- cgit v1.2.3