This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
[patch] Fix std::notify_all_at_thread_exit test for older glibc
- From: Jonathan Wakely <jwakely at redhat dot com>
- To: libstdc++ at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Thu, 11 Dec 2014 17:58:33 +0000
- Subject: [patch] Fix std::notify_all_at_thread_exit test for older glibc
- Authentication-results: sourceware.org; auth=none
I'm seeing this test timeout on glibc 2.13, which I think is because
it doesn't provide __cxa_atexit_thread_impl and so the thread_local
destructor and the notify_all() happen in an unspecified order.
Tested x86_64-linux, committed to trunk.
commit 299704c621dd7afaee7c5fb2a354b40ef41c2eba
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Thu Dec 11 17:12:17 2014 +0000
* testsuite/30_threads/condition_variable/members/3.cc: Only use
a thread_local when __cxa_thread_atexit_impl is available.
diff --git a/libstdc++-v3/testsuite/30_threads/condition_variable/members/3.cc b/libstdc++-v3/testsuite/30_threads/condition_variable/members/3.cc
index 0da545d..1788bcf 100644
--- a/libstdc++-v3/testsuite/30_threads/condition_variable/members/3.cc
+++ b/libstdc++-v3/testsuite/30_threads/condition_variable/members/3.cc
@@ -41,7 +41,12 @@ void func()
{
std::unique_lock<std::mutex> lock{mx};
std::notify_all_at_thread_exit(cv, std::move(lock));
+#if _GLIBCXX_HAVE___CXA_THREAD_ATEXIT_IMPL
+ // Correct order of thread_local destruction needs __cxa_thread_atexit_impl
static thread_local Inc inc;
+#else
+ Inc inc;
+#endif
}
int main()