[PATCH] D25468: [libcxx] Do not declare the thread api when __external_threading is present

Asiri Rathnayake via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 11 05:26:13 PDT 2016


rmaprath created this revision.
rmaprath added a reviewer: EricWF.
rmaprath added a subscriber: cfe-commits.

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.


https://reviews.llvm.org/D25468

Files:
  include/__threading_support


Index: include/__threading_support
===================================================================
--- include/__threading_support
+++ include/__threading_support
@@ -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 @@
 
 _LIBCPP_END_NAMESPACE_STD
 
+#endif // !_LIBCPP_HAS_EXTERNAL_THREADING_HEADER
+
 #endif // _LIBCPP_HAS_NO_THREADS
 
 #endif // _LIBCPP_THREADING_SUPPORT


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25468.74234.patch
Type: text/x-patch
Size: 1026 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161011/56feef2d/attachment.bin>


More information about the cfe-commits mailing list