Commit dc8bc65b by Jonathan Wakely Committed by Jonathan Wakely

Define testsuite macro for correct thread_local destructors

	* testsuite/30_threads/condition_variable/members/3.cc: Use new macro
	to detect correct thread_local destructors.
	* testsuite/util/testsuite_hooks.h (CORRECT_THREAD_LOCAL_DTORS):
	Define.

From-SVN: r244226
parent cb627cdf
2017-01-09 Jonathan Wakely <jwakely@redhat.com> 2017-01-09 Jonathan Wakely <jwakely@redhat.com>
* testsuite/30_threads/condition_variable/members/3.cc: Use new macro
to detect correct thread_local destructors.
* testsuite/util/testsuite_hooks.h (CORRECT_THREAD_LOCAL_DTORS):
Define.
2017-01-09 Jonathan Wakely <jwakely@redhat.com>
Aditya Kumar <hiraditya@msn.com> Aditya Kumar <hiraditya@msn.com>
PR libstdc++/66414 PR libstdc++/66414
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <condition_variable> #include <condition_variable>
#include <thread> #include <thread>
#include <mutex> #include <mutex>
#include <testsuite_hooks.h>
std::mutex mx; std::mutex mx;
std::condition_variable cv; std::condition_variable cv;
...@@ -40,12 +41,12 @@ void func() ...@@ -40,12 +41,12 @@ void func()
{ {
std::unique_lock<std::mutex> lock{mx}; std::unique_lock<std::mutex> lock{mx};
std::notify_all_at_thread_exit(cv, std::move(lock)); std::notify_all_at_thread_exit(cv, std::move(lock));
#if _GLIBCXX_HAVE___CXA_THREAD_ATEXIT_IMPL #if CORRECT_THREAD_LOCAL_DTORS
// Correct order of thread_local destruction needs __cxa_thread_atexit_impl // Correct order of thread_local destruction needs __cxa_thread_atexit_impl
static thread_local Inc inc; // or similar support from libc.
#else static thread_local
Inc inc;
#endif #endif
Inc inc;
} }
int main() int main()
......
...@@ -81,6 +81,12 @@ ...@@ -81,6 +81,12 @@
# define THROW(X) noexcept(false) # define THROW(X) noexcept(false)
#endif #endif
#if _GLIBCXX_HAVE___CXA_THREAD_ATEXIT || _GLIBCXX_HAVE___CXA_THREAD_ATEXIT_IMPL
// Correct order of thread_local destruction needs __cxa_thread_atexit_impl
// or similar support from libc.
# define CORRECT_THREAD_LOCAL_DTORS 1
#endif
namespace __gnu_test namespace __gnu_test
{ {
// All macros are defined in GLIBCXX_CONFIGURE_TESTSUITE and imported // All macros are defined in GLIBCXX_CONFIGURE_TESTSUITE and imported
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment