[libcxx] r284232 - [libcxx] Do not declare the thread api when __external_threading is present

Asiri Rathnayake via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 14 06:00:07 PDT 2016


Author: asiri
Date: Fri Oct 14 08:00:07 2016
New Revision: 284232

URL: http://llvm.org/viewvc/llvm-project?rev=284232&view=rev
Log:
[libcxx] Do not declare the thread api when __external_threading is present

This fixes a small omission where even when __external_threading is provided,
we attempt to declare a pthread based threading API. Instead, we should leave
out everything for the __external_threading header to take care of.

The __threading_support header provides a proof-of-concept externally threaded
libc++ variant when _LIBCPP_HAS_THREAD_API_EXTERNAL is defined. But if the
__external_threading header is present, we should exclude all of that POC stuff.

Reviewers: EricWF

Differential revision: https://reviews.llvm.org/D25468

Modified:
    libcxx/trunk/include/__threading_support

Modified: libcxx/trunk/include/__threading_support
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__threading_support?rev=284232&r1=284231&r2=284232&view=diff
==============================================================================
--- libcxx/trunk/include/__threading_support (original)
+++ libcxx/trunk/include/__threading_support Fri Oct 14 08:00:07 2016
@@ -25,17 +25,16 @@
 #if defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
 #if !defined(__clang__) && (_GNUC_VER < 500)
 #include <__external_threading>
-#define _LIBCPP_EXTERNAL_THREADING
+#define _LIBCPP_HAS_EXTERNAL_THREADING_HEADER
 #elif !defined(__has_include) || __has_include(<__external_threading>)
 #include <__external_threading>
-#define _LIBCPP_EXTERNAL_THREADING
+#define _LIBCPP_HAS_EXTERNAL_THREADING_HEADER
 #endif
 #endif
 
-#if !defined(_LIBCPP_EXTERNAL_THREADING)
+#if !defined(_LIBCPP_HAS_EXTERNAL_THREADING_HEADER)
 #include <pthread.h>
 #include <sched.h>
-#endif
 
 #if defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
 #define _LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_FUNC_VIS
@@ -242,6 +241,8 @@ void __libcpp_tls_set(__libcpp_tls_key _
 
 _LIBCPP_END_NAMESPACE_STD
 
+#endif // !_LIBCPP_HAS_EXTERNAL_THREADING_HEADER
+
 #endif // _LIBCPP_HAS_NO_THREADS
 
 #endif // _LIBCPP_THREADING_SUPPORT




More information about the cfe-commits mailing list