[libcxx] Allow explicit pthread opt-in
The existing pthread detection code in __config is pretty good for
common operating systems. It doesn't allow cmake-time choices to be
made for uncommon operating systems though.
This change adds the LIBCXX_HAS_PTHREAD_API cmake flag, which turns
into the _LIBCPP_HAS_THREAD_API_PTHREAD preprocessor define. This is
a name change from the old _LIBCPP_THREAD_API_PTHREAD. The lit tests
want __config_site.in variables to have a _LIBCPP_HAS prefix.
http://reviews.llvm.org/D20573
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@270735 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/__threading_support b/include/__threading_support
index 49fdca2..c9a4ea9 100644
--- a/include/__threading_support
+++ b/include/__threading_support
@@ -19,14 +19,14 @@
#ifndef _LIBCPP_HAS_NO_THREADS
-#if defined(_LIBCPP_THREAD_API_PTHREAD)
+#if defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
#include <pthread.h>
#include <sched.h>
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
-#if defined(_LIBCPP_THREAD_API_PTHREAD)
+#if defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
// Mutex
#define _LIBCPP_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
@@ -194,7 +194,7 @@
pthread_setspecific(__key, __p);
}
-#else // !_LIBCPP_THREAD_API_PTHREAD
+#else // !_LIBCPP_HAS_THREAD_API_PTHREAD
#error "No thread API selected."
#endif