+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>
#include <condition_variable>
#include <thread>
#include <mutex>
+#include <testsuite_hooks.h>
std::mutex mx;
std::condition_variable cv;
{
std::unique_lock<std::mutex> lock{mx};
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
- static thread_local Inc inc;
-#else
- Inc inc;
+ // or similar support from libc.
+ static thread_local
#endif
+ Inc inc;
}
int main()
# define THROW(X) noexcept(false)
#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
{
// All macros are defined in GLIBCXX_CONFIGURE_TESTSUITE and imported