<div dir="ltr">Hi Mike,<div><br></div><div>Can you check if <a href="https://reviews.llvm.org/D24475">https://reviews.llvm.org/D24475</a> fixes the issue for you? This looks like a bug in the gcc pre-processor (in older versions of gcc).</div><div><br></div><div>I'm a bit hesitant because my gcc (4.8.3) bumps into a different issue (crash!) as well, but that seem to have nothing to do with my patch (can reproduce without my patch...).</div><div><br></div><div>Cheers,</div><div><br></div><div>/ Asiri</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Sep 12, 2016 at 9:49 PM, Asiri Rathnayake <span dir="ltr"><<a href="mailto:asiri.rathnayake@gmail.com" target="_blank">asiri.rathnayake@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">OK, I'm able to reproduce locally. Looks like gcc (4.8.3 at least) does not like my patch.<div><br></div><div>Working on a fix...</div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Sep 12, 2016 at 9:43 PM, Asiri Rathnayake <span dir="ltr"><<a href="mailto:asiri.rathnayake@gmail.com" target="_blank">asiri.rathnayake@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Mike,<div><br></div><div>That does look related to my change. Is this an internal build? I was looking out for the bots on <a href="http://llvm.org" target="_blank">llvm.org</a> but didn't spot any issues (yet).</div><div><br></div><div>Will try to reproduce locally. Would it be OK if I find a fix tomorrow? (night time here in the UK), can revert if this is blocking you.</div><div><br></div><div>Cheers,</div><div><br></div><div>/ Asiri</div><div><br></div></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Sep 12, 2016 at 9:25 PM, Mike Aizatsky via cfe-commits <span dir="ltr"><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Asiri,<div><br></div><div>The boot strap build has started to fail for. Your change seems to be related, right?</div><div><br></div><div><div>[14/22] Building CXX object projects/libcxx/lib/CMakeFiles<wbr>/cxx_objects.dir/__/src/locale<wbr>.cpp.o</div><div>FAILED: /usr/bin/g++   -D_DEBUG -D_GNU_SOURCE -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM<wbr>_HEADER -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Iprojects/libcxx/lib -I/usr/local/google/home/aizat<wbr>sky/</div><div>src/llvm/projects/libcxx/lib -Iinclude -I/usr/local/google/home/aizat<wbr>sky/src/llvm/include -I/usr/local/google/home/aizat<wbr>sky/src/llvm/projects/libcxx/i<wbr>nclude -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unuse</div><div>d-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializer<wbr>s  -Wno-long-long -Wno-maybe-uninitialized -Wdelete-non-virtual-dtor -Wno-comment -std=c++11 -ffunction-sections -fdata-sections -O3     -UN</div><div>DEBUG -DLIBCXX_BUILDING_LIBCXXABI -std=c++11 -nostdinc++ -Wall -Wextra -W -Wwrite-strings -Wno-unused-parameter -Wno-long-long -Werror=return-type -Wno-attributes -Wno-literal-suffix -Wno-c++14-compat -Wno-erro</div><div>r -fPIC -MMD -MT projects/libcxx/lib/CMakeFiles<wbr>/cxx_objects.dir/__/src/locale<wbr>.cpp.o -MF projects/libcxx/lib/CMakeFiles<wbr>/cxx_objects.dir/__/src/locale<wbr>.cpp.o.d -o projects/libcxx/lib/CMakeFiles<wbr>/cxx_objects.dir/__/</div><div>src/locale.cpp.o -c /usr/local/google/home/aizatsk<wbr>y/src/llvm/projects/libcxx/src<wbr>/locale.cpp</div><div>In file included from /usr/local/google/home/aizatsk<wbr>y/src/llvm/projects/libcxx/inc<wbr>lude/__mutex_base:17:0,</div><div>                 from /usr/local/google/home/aizatsk<wbr>y/src/llvm/projects/libcxx/inc<wbr>lude/mutex:189,</div><div>                 from /usr/local/google/home/aizatsk<wbr>y/src/llvm/projects/libcxx/inc<wbr>lude/__locale:18,</div><div>                 from /usr/local/google/home/aizatsk<wbr>y/src/llvm/projects/libcxx/inc<wbr>lude/locale:182,</div><div>                 from /usr/local/google/home/aizatsk<wbr>y/src/llvm/projects/libcxx/src<wbr>/locale.cpp:17:</div><div>/usr/local/google/home/aizatsk<wbr>y/src/llvm/projects/libcxx/inc<wbr>lude/__threading_support:22:<wbr>90: error: missing binary operator before token "("</div><span><div> #if defined(_LIBCPP_HAS_THREAD_API<wbr>_EXTERNAL) && (!defined(__has_include) || __has_include(<__external_thre<wbr>ading>))</div></span><div>                                                                                          ^</div><div>In file included from /usr/local/google/home/aizatsk<wbr>y/src/llvm/projects/libcxx/inc<wbr>lude/algorithm:637:0,</div><div>                 from /usr/local/google/home/aizatsk<wbr>y/src/llvm/projects/libcxx/inc<wbr>lude/__string:55,</div><div>                 from /usr/local/google/home/aizatsk<wbr>y/src/llvm/projects/libcxx/inc<wbr>lude/string_view:166,</div><div>                 from /usr/local/google/home/aizatsk<wbr>y/src/llvm/projects/libcxx/inc<wbr>lude/string:464,</div><div>                 from /usr/local/google/home/aizatsk<wbr>y/src/llvm/projects/libcxx/src<wbr>/locale.cpp:16:</div></div><div><br></div></div><div><div><br><div class="gmail_quote"><div dir="ltr">On Sun, Sep 11, 2016 at 2:55 PM Asiri Rathnayake via cfe-commits <<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: asiri<br>
Date: Sun Sep 11 16:46:40 2016<br>
New Revision: 281179<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=281179&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject?rev=281179&view=rev</a><br>
Log:<br>
[libcxx] Introduce an externally-threaded libc++ variant.<br>
<br>
This patch further decouples libc++ from pthread, allowing libc++ to be built<br>
against other threading systems. There are two main use cases:<br>
<br>
- Building libc++ against a thread library other than pthreads.<br>
<br>
- Building libc++ with an "external" thread API, allowing a separate library to<br>
  provide the implementation of that API.<br>
<br>
The two use cases are quite similar, the second one being sligtly more<br>
de-coupled than the first. The cmake option LIBCXX_HAS_EXTERNAL_THREAD_API<br>
enables both kinds of builds. One needs to place an <__external_threading><br>
header file containing an implementation of the "libc++ thread API" declared<br>
in the <__threading_support> header.<br>
<br>
For the second use case, the implementation of the libc++ thread API can<br>
delegate to a custom "external" thread API where the implementation of this<br>
external API is provided in a seperate library. This mechanism allows toolchain<br>
vendors to distribute a build of libc++ with a custom thread-porting-layer API<br>
(which is the "external" API above), platform vendors (recipients of the<br>
toolchain/libc++) are then required to provide their implementation of this API<br>
to be linked with (end-user) C++ programs.<br>
<br>
Note that the second use case still requires establishing the basic types that<br>
get passed between the external thread library and the libc++ library<br>
(e.g. __libcpp_mutex_t). These cannot be opaque pointer types (libc++ sources<br>
won't compile otherwise). It should also be noted that the second use case can<br>
have a slight performance penalty; as all the thread constructs need to cross a<br>
library boundary through an additional function call.<br>
<br>
When the header <__external_threading> is omitted, libc++ is built with the<br>
"libc++ thread API" (declared in <__threading_support>) as the "external" thread<br>
API (basic types are pthread based). An implementation (pthread based) of this<br>
API is provided in test/support/external_threads.<wbr>cpp, which is built into a<br>
separate DSO and linked in when running the libc++ test suite. A test run<br>
therefore demonstrates the second use case (less the intermediate custom API).<br>
<br>
Differential revision: <a href="https://reviews.llvm.org/D21968" rel="noreferrer" target="_blank">https://reviews.llvm.org/D2196<wbr>8</a><br>
<br>
Reviewers: bcraig, compnerd, EricWF, mclow.lists<br>
<br>
Added:<br>
    libcxx/trunk/test/support/exte<wbr>rnal_threads.cpp<br>
      - copied, changed from r280988, libcxx/trunk/test/libcxx/threa<wbr>d/thread.mutex/<a href="http://thread.mutex.re">thread.mutex.re</a><wbr>quirements/thread.mutex.requir<wbr>ements.mutex/thread.mutex.<wbr>class/native_handle.pass.cpp<br>
Modified:<br>
    libcxx/trunk/CMakeLists.txt<br>
    libcxx/trunk/include/__config<br>
    libcxx/trunk/include/__<a href="http://config_site.in" rel="noreferrer" target="_blank">config_<wbr>site.in</a><br>
    libcxx/trunk/include/__threadi<wbr>ng_support<br>
    libcxx/trunk/include/thread<br>
    libcxx/trunk/lib/CMakeLists.tx<wbr>t<br>
    libcxx/trunk/test/CMakeLists.t<wbr>xt<br>
    libcxx/trunk/test/libcxx/test/<wbr>config.py<br>
    libcxx/trunk/test/libcxx/threa<wbr>d/thread.condition/thread.cond<wbr>ition.condvar/native_handle.<wbr>pass.cpp<br>
    libcxx/trunk/test/libcxx/threa<wbr>d/thread.mutex/<a href="http://thread.mutex.re">thread.mutex.re</a><wbr>quirements/thread.mutex.requir<wbr>ements.mutex/thread.mutex.<wbr>class/native_handle.pass.cpp<br>
    libcxx/trunk/test/libcxx/threa<wbr>d/thread.mutex/<a href="http://thread.mutex.re">thread.mutex.re</a><wbr>quirements/thread.mutex.requir<wbr>ements.mutex/thread.mutex.<wbr>recursive/native_handle.pass.<wbr>cpp<br>
    libcxx/trunk/test/libcxx/threa<wbr>d/thread.threads/thread.thread<wbr>.class/thread.thread.member/na<wbr>tive_handle.pass.cpp<br>
    libcxx/trunk/test/libcxx/threa<wbr>d/thread.threads/thread.thread<wbr>.class/types.pass.cpp<br>
    libcxx/trunk/test/<a href="http://lit.site.cfg.in" rel="noreferrer" target="_blank">lit.site.cfg<wbr>.in</a><br>
<br>
Modified: libcxx/trunk/CMakeLists.txt<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/CMakeLists.txt?rev=281179&r1=281178&r2=281179&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/libcxx/trunk/CMakeLists.<wbr>txt?rev=281179&r1=281178&r2=28<wbr>1179&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- libcxx/trunk/CMakeLists.txt (original)<br>
+++ libcxx/trunk/CMakeLists.txt Sun Sep 11 16:46:40 2016<br>
@@ -140,6 +140,9 @@ option(LIBCXX_ENABLE_MONOTONIC<wbr>_CLOCK<br>
    This option may only be set to OFF when LIBCXX_ENABLE_THREADS=OFF." ON)<br>
 option(LIBCXX_HAS_MUSL_LIBC "Build libc++ with support for the Musl C library" OFF)<br>
 option(LIBCXX_HAS_PTHREAD_API "Ignore auto-detection and force use of pthread API" OFF)<br>
+option(LIBCXX_HAS_EXTERNAL_TH<wbr>READ_API<br>
+  "Build libc++ with an externalized threading API.<br>
+   This option may only be set to ON when LIBCXX_ENABLE_THREADS=ON." OFF)<br>
<br>
 # Misc options ------------------------------<wbr>------------------------------<wbr>----<br>
 # FIXME: Turn -pedantic back ON. It is currently off because it warns<br>
@@ -197,6 +200,11 @@ if(LIBCXX_HAS_PTHREAD_API AND NOT LIBCXX<br>
                       " when LIBCXX_ENABLE_THREADS is also set to ON.")<br>
 endif()<br>
<br>
+if(LIBCXX_HAS_EXTERNAL_THREAD<wbr>_API AND NOT LIBCXX_ENABLE_THREADS)<br>
+  message(FATAL_ERROR "LIBCXX_HAS_EXTERNAL_THREAD_AP<wbr>I can only be set to ON"<br>
+                      " when LIBCXX_ENABLE_THREADS is also set to ON.")<br>
+endif()<br>
+<br>
 # Ensure LLVM_USE_SANITIZER is not specified when LIBCXX_GENERATE_COVERAGE<br>
 # is ON.<br>
 if (LLVM_USE_SANITIZER AND LIBCXX_GENERATE_COVERAGE)<br>
@@ -371,6 +379,17 @@ if (NOT LIBCXX_ENABLE_RTTI)<br>
   add_compile_flags_if_supporte<wbr>d(-fno-rtti)<br>
 endif()<br>
<br>
+# Threading flags ==============================<wbr>==============================<wbr>=<br>
+if (LIBCXX_HAS_EXTERNAL_THREAD_AP<wbr>I AND LIBCXX_ENABLE_SHARED)<br>
+  # Need to allow unresolved symbols if this is to work with shared library builds<br>
+  if (APPLE)<br>
+    add_link_flags("-undefined dynamic_lookup")<br>
+  else()<br>
+    # Relax this restriction from HandleLLVMOptions<br>
+    string(REPLACE "-Wl,-z,defs" "" CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}"<wbr>)<br>
+  endif()<br>
+endif()<br>
+<br>
 # Assertion flags ==============================<wbr>==============================<wbr>=<br>
 define_if(LIBCXX_ENABLE_ASSER<wbr>TIONS -UNDEBUG)<br>
 define_if_not(LIBCXX_ENABLE_A<wbr>SSERTIONS -DNDEBUG)<br>
@@ -432,6 +451,7 @@ config_define_if_not(LIBCXX_EN<wbr>ABLE_MONOT<br>
 config_define_if_not(LIBCXX_E<wbr>NABLE_THREAD_UNSAFE_C_FUNCTION<wbr>S _LIBCPP_HAS_NO_THREAD_UNSAFE_C<wbr>_FUNCTIONS)<br>
<br>
 config_define_if(LIBCXX_HAS_P<wbr>THREAD_API _LIBCPP_HAS_THREAD_API_PTHREAD<wbr>)<br>
+config_define_if(LIBCXX_HAS_E<wbr>XTERNAL_THREAD_API _LIBCPP_HAS_THREAD_API_EXTERNA<wbr>L)<br>
 config_define_if(LIBCXX_HAS_M<wbr>USL_LIBC _LIBCPP_HAS_MUSL_LIBC)<br>
<br>
 if (LIBCXX_NEEDS_SITE_CONFIG)<br>
<br>
Modified: libcxx/trunk/include/__config<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=281179&r1=281178&r2=281179&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/libcxx/trunk/include/__c<wbr>onfig?rev=281179&r1=281178&r2=<wbr>281179&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- libcxx/trunk/include/__config (original)<br>
+++ libcxx/trunk/include/__config Sun Sep 11 16:46:40 2016<br>
@@ -831,7 +831,9 @@ extern "C" void __sanitizer_annotate_con<br>
 #endif<br>
<br>
 // Thread API<br>
-#if !defined(_LIBCPP_HAS_NO_THREAD<wbr>S) && !defined(_LIBCPP_HAS_THREAD_AP<wbr>I_PTHREAD)<br>
+#if !defined(_LIBCPP_HAS_NO_THREAD<wbr>S) && \<br>
+    !defined(_LIBCPP_HAS_THREAD_AP<wbr>I_PTHREAD) && \<br>
+    !defined(_LIBCPP_HAS_THREAD_AP<wbr>I_EXTERNAL)<br>
 # if defined(__FreeBSD__) || \<br>
     defined(__NetBSD__) || \<br>
     defined(__linux__) || \<br>
@@ -849,6 +851,11 @@ extern "C" void __sanitizer_annotate_con<br>
          _LIBCPP_HAS_NO_THREADS is not defined.<br>
 #endif<br>
<br>
+#if defined(_LIBCPP_HAS_NO_THREADS<wbr>) && defined(_LIBCPP_HAS_THREAD_API<wbr>_EXTERNAL)<br>
+#  error _LIBCPP_HAS_EXTERNAL_THREAD_AP<wbr>I may not be defined when \<br>
+         _LIBCPP_HAS_NO_THREADS is defined.<br>
+#endif<br>
+<br>
 #if defined(_LIBCPP_HAS_NO_MONOTON<wbr>IC_CLOCK) && !defined(_LIBCPP_HAS_NO_THREAD<wbr>S)<br>
 #  error _LIBCPP_HAS_NO_MONOTONIC_CLOCK may only be defined when \<br>
          _LIBCPP_HAS_NO_THREADS is defined.<br>
<br>
Modified: libcxx/trunk/include/__<a href="http://config_site.in" rel="noreferrer" target="_blank">config_<wbr>site.in</a><br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config_site.in?rev=281179&r1=281178&r2=281179&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/libcxx/trunk/include/__c<wbr>onfig_site.in?rev=281179&r1=28<wbr>1178&r2=281179&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- libcxx/trunk/include/__<a href="http://config_site.in" rel="noreferrer" target="_blank">config_<wbr>site.in</a> (original)<br>
+++ libcxx/trunk/include/__<a href="http://config_site.in" rel="noreferrer" target="_blank">config_<wbr>site.in</a> Sun Sep 11 16:46:40 2016<br>
@@ -20,5 +20,6 @@<br>
 #cmakedefine _LIBCPP_HAS_NO_THREAD_UNSAFE_C<wbr>_FUNCTIONS<br>
 #cmakedefine _LIBCPP_HAS_MUSL_LIBC<br>
 #cmakedefine _LIBCPP_HAS_THREAD_API_PTHREAD<br>
+#cmakedefine _LIBCPP_HAS_THREAD_API_EXTERNA<wbr>L<br>
<br>
 #endif // _LIBCPP_CONFIG_SITE<br>
<br>
Modified: libcxx/trunk/include/__threadi<wbr>ng_support<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__threading_support?rev=281179&r1=281178&r2=281179&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/libcxx/trunk/include/__t<wbr>hreading_support?rev=281179&r1<wbr>=281178&r2=281179&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- libcxx/trunk/include/__threadi<wbr>ng_support (original)<br>
+++ libcxx/trunk/include/__threadi<wbr>ng_support Sun Sep 11 16:46:40 2016<br>
@@ -19,20 +19,83 @@<br>
<br>
 #ifndef _LIBCPP_HAS_NO_THREADS<br>
<br>
-#if defined(_LIBCPP_HAS_THREAD_API<wbr>_PTHREAD)<br>
+#if defined(_LIBCPP_HAS_THREAD_API<wbr>_EXTERNAL) && (!defined(__has_include) || __has_include(<__external_thre<wbr>ading>))<br>
+#include <__external_threading><br>
+#else<br>
 #include <pthread.h><br>
 #include <sched.h><br>
 #endif<br>
<br>
-_LIBCPP_BEGIN_NAMESPACE_STD<br>
+#if defined(_LIBCPP_HAS_THREAD_API<wbr>_EXTERNAL)<br>
+#define _LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_FUNC_VIS<br>
+#else<br>
+#define _LIBCPP_THREAD_ABI_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY<br>
+#endif<br>
<br>
-#if defined(_LIBCPP_HAS_THREAD_API<wbr>_PTHREAD)<br>
+_LIBCPP_BEGIN_NAMESPACE_STD<br>
<br>
 // Mutex<br>
-#define _LIBCPP_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER<br>
 typedef pthread_mutex_t __libcpp_mutex_t;<br>
+#define _LIBCPP_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER<br>
+<br>
+_LIBCPP_THREAD_ABI_VISIBILITY<br>
+int __libcpp_recursive_mutex_init(<wbr>__libcpp_mutex_t* __m);<br>
+_LIBCPP_THREAD_ABI_VISIBILITY<br>
+int __libcpp_mutex_lock(__libcpp_m<wbr>utex_t* __m);<br>
+_LIBCPP_THREAD_ABI_VISIBILITY<br>
+int __libcpp_mutex_trylock(__libcp<wbr>p_mutex_t* __m);<br>
+_LIBCPP_THREAD_ABI_VISIBILITY<br>
+int __libcpp_mutex_unlock(__libcpp<wbr>_mutex_t* __m);<br>
+_LIBCPP_THREAD_ABI_VISIBILITY<br>
+int __libcpp_mutex_destroy(__libcp<wbr>p_mutex_t* __m);<br>
+<br>
+// Condition variable<br>
+typedef pthread_cond_t __libcpp_condvar_t;<br>
+#define _LIBCPP_CONDVAR_INITIALIZER PTHREAD_COND_INITIALIZER<br>
+_LIBCPP_THREAD_ABI_VISIBILITY<br>
+int __libcpp_condvar_signal(__libc<wbr>pp_condvar_t* __cv);<br>
+_LIBCPP_THREAD_ABI_VISIBILITY<br>
+int __libcpp_condvar_broadcast(__l<wbr>ibcpp_condvar_t* __cv);<br>
+_LIBCPP_THREAD_ABI_VISIBILITY<br>
+int __libcpp_condvar_wait(__libcpp<wbr>_condvar_t* __cv, __libcpp_mutex_t* __m);<br>
+_LIBCPP_THREAD_ABI_VISIBILITY<br>
+int __libcpp_condvar_timedwait(__l<wbr>ibcpp_condvar_t* __cv, __libcpp_mutex_t* __m, timespec* __ts);<br>
+_LIBCPP_THREAD_ABI_VISIBILITY<br>
+int __libcpp_condvar_destroy(__lib<wbr>cpp_condvar_t* __cv);<br>
+<br>
+// Thread id<br>
+typedef pthread_t __libcpp_thread_id;<br>
+_LIBCPP_THREAD_ABI_VISIBILITY<br>
+bool __libcpp_thread_id_equal(__lib<wbr>cpp_thread_id t1, __libcpp_thread_id t2);<br>
+_LIBCPP_THREAD_ABI_VISIBILITY<br>
+bool __libcpp_thread_id_less(__libc<wbr>pp_thread_id t1, __libcpp_thread_id t2);<br>
+<br>
+// Thread<br>
+typedef pthread_t __libcpp_thread_t;<br>
+_LIBCPP_THREAD_ABI_VISIBILITY<br>
+int __libcpp_thread_create(__libcp<wbr>p_thread_t* __t, void* (*__func)(void*), void* __arg);<br>
+_LIBCPP_THREAD_ABI_VISIBILITY<br>
+__libcpp_thread_id __libcpp_thread_get_current_id<wbr>();<br>
+_LIBCPP_THREAD_ABI_VISIBILITY<br>
+__libcpp_thread_id __libcpp_thread_get_id(const __libcpp_thread_t* __t);<br>
+_LIBCPP_THREAD_ABI_VISIBILITY<br>
+int __libcpp_thread_join(__libcpp_<wbr>thread_t* __t);<br>
+_LIBCPP_THREAD_ABI_VISIBILITY<br>
+int __libcpp_thread_detach(__libcp<wbr>p_thread_t* __t);<br>
+_LIBCPP_THREAD_ABI_VISIBILITY<br>
+void __libcpp_thread_yield();<br>
+<br>
+// Thread local storage<br>
+typedef pthread_key_t __libcpp_tls_key;<br>
+_LIBCPP_THREAD_ABI_VISIBILITY<br>
+int __libcpp_tls_create(__libcpp_t<wbr>ls_key* __key, void (*__at_exit)(void*));<br>
+_LIBCPP_THREAD_ABI_VISIBILITY<br>
+void* __libcpp_tls_get(__libcpp_tls_<wbr>key __key);<br>
+_LIBCPP_THREAD_ABI_VISIBILITY<br>
+void __libcpp_tls_set(__libcpp_tls_<wbr>key __key, void* __p);<br>
+<br>
+#if defined(_LIBCPP_HAS_THREAD_API<wbr>_PTHREAD) || defined(_LIBCPP_BUILDING_EXTER<wbr>NAL_THREADS)<br>
<br>
-inline _LIBCPP_ALWAYS_INLINE<br>
 int __libcpp_recursive_mutex_init(<wbr>__libcpp_mutex_t* __m)<br>
 {<br>
     pthread_mutexattr_t attr;<br>
@@ -59,144 +122,112 @@ int __libcpp_recursive_mutex_init(<wbr>__libc<br>
     return 0;<br>
 }<br>
<br>
-inline _LIBCPP_ALWAYS_INLINE<br>
 int __libcpp_mutex_lock(__libcpp_m<wbr>utex_t* __m)<br>
 {<br>
     return pthread_mutex_lock(__m);<br>
 }<br>
<br>
-inline _LIBCPP_ALWAYS_INLINE<br>
 int __libcpp_mutex_trylock(__libcp<wbr>p_mutex_t* __m)<br>
 {<br>
     return pthread_mutex_trylock(__m);<br>
 }<br>
<br>
-inline _LIBCPP_ALWAYS_INLINE<br>
 int __libcpp_mutex_unlock(__libcpp<wbr>_mutex_t* __m)<br>
 {<br>
     return pthread_mutex_unlock(__m);<br>
 }<br>
<br>
-inline _LIBCPP_ALWAYS_INLINE<br>
 int __libcpp_mutex_destroy(__libcp<wbr>p_mutex_t* __m)<br>
 {<br>
     return pthread_mutex_destroy(__m);<br>
 }<br>
<br>
 // Condition variable<br>
-#define _LIBCPP_CONDVAR_INITIALIZER PTHREAD_COND_INITIALIZER<br>
-typedef pthread_cond_t __libcpp_condvar_t;<br>
-<br>
-inline _LIBCPP_ALWAYS_INLINE<br>
 int __libcpp_condvar_signal(__libc<wbr>pp_condvar_t* __cv)<br>
 {<br>
     return pthread_cond_signal(__cv);<br>
 }<br>
<br>
-inline _LIBCPP_ALWAYS_INLINE<br>
 int __libcpp_condvar_broadcast(__l<wbr>ibcpp_condvar_t* __cv)<br>
 {<br>
     return pthread_cond_broadcast(__cv);<br>
 }<br>
<br>
-inline _LIBCPP_ALWAYS_INLINE<br>
 int __libcpp_condvar_wait(__libcpp<wbr>_condvar_t* __cv, __libcpp_mutex_t* __m)<br>
 {<br>
     return pthread_cond_wait(__cv, __m);<br>
 }<br>
<br>
-inline _LIBCPP_ALWAYS_INLINE<br>
 int __libcpp_condvar_timedwait(__l<wbr>ibcpp_condvar_t* __cv, __libcpp_mutex_t* __m, timespec* __ts)<br>
 {<br>
     return pthread_cond_timedwait(__cv, __m, __ts);<br>
 }<br>
<br>
-inline _LIBCPP_ALWAYS_INLINE<br>
 int __libcpp_condvar_destroy(__lib<wbr>cpp_condvar_t* __cv)<br>
 {<br>
     return pthread_cond_destroy(__cv);<br>
 }<br>
<br>
-// Thread id<br>
-typedef pthread_t __libcpp_thread_id;<br>
-<br>
 // Returns non-zero if the thread ids are equal, otherwise 0<br>
-inline _LIBCPP_ALWAYS_INLINE<br>
 bool __libcpp_thread_id_equal(__lib<wbr>cpp_thread_id t1, __libcpp_thread_id t2)<br>
 {<br>
     return pthread_equal(t1, t2) != 0;<br>
 }<br>
<br>
 // Returns non-zero if t1 < t2, otherwise 0<br>
-inline _LIBCPP_ALWAYS_INLINE<br>
 bool __libcpp_thread_id_less(__libc<wbr>pp_thread_id t1, __libcpp_thread_id t2)<br>
 {<br>
     return t1 < t2;<br>
 }<br>
<br>
 // Thread<br>
-typedef pthread_t __libcpp_thread_t;<br>
-<br>
-inline _LIBCPP_ALWAYS_INLINE<br>
 int __libcpp_thread_create(__libcp<wbr>p_thread_t* __t, void* (*__func)(void*), void* __arg)<br>
 {<br>
     return pthread_create(__t, 0, __func, __arg);<br>
 }<br>
<br>
-inline _LIBCPP_ALWAYS_INLINE<br>
 __libcpp_thread_id __libcpp_thread_get_current_id<wbr>()<br>
 {<br>
     return pthread_self();<br>
 }<br>
<br>
-inline _LIBCPP_ALWAYS_INLINE<br>
 __libcpp_thread_id __libcpp_thread_get_id(const __libcpp_thread_t* __t)<br>
 {<br>
     return *__t;<br>
 }<br>
<br>
-inline _LIBCPP_ALWAYS_INLINE<br>
 int __libcpp_thread_join(__libcpp_<wbr>thread_t* __t)<br>
 {<br>
     return pthread_join(*__t, 0);<br>
 }<br>
<br>
-inline _LIBCPP_ALWAYS_INLINE<br>
 int __libcpp_thread_detach(__libcp<wbr>p_thread_t* __t)<br>
 {<br>
     return pthread_detach(*__t);<br>
 }<br>
<br>
-inline _LIBCPP_ALWAYS_INLINE<br>
 void __libcpp_thread_yield()<br>
 {<br>
     sched_yield();<br>
 }<br>
<br>
 // Thread local storage<br>
-typedef pthread_key_t __libcpp_tl_key;<br>
-<br>
-inline _LIBCPP_ALWAYS_INLINE<br>
-int __libcpp_tl_create(__libcpp_tl<wbr>_key* __key, void (*__at_exit)(void*))<br>
+int __libcpp_tls_create(__libcpp_t<wbr>ls_key* __key, void (*__at_exit)(void*))<br>
 {<br>
     return pthread_key_create(__key, __at_exit);<br>
 }<br>
<br>
-inline _LIBCPP_ALWAYS_INLINE<br>
-void* __libcpp_tl_get(__libcpp_tl_ke<wbr>y __key)<br>
+void* __libcpp_tls_get(__libcpp_tls_<wbr>key __key)<br>
 {<br>
     return pthread_getspecific(__key);<br>
 }<br>
<br>
-inline _LIBCPP_ALWAYS_INLINE<br>
-void __libcpp_tl_set(__libcpp_tl_ke<wbr>y __key, void* __p)<br>
+void __libcpp_tls_set(__libcpp_tls_<wbr>key __key, void* __p)<br>
 {<br>
     pthread_setspecific(__key, __p);<br>
 }<br>
<br>
-#else // !_LIBCPP_HAS_THREAD_API_PTHREA<wbr>D<br>
-  #error "No thread API selected."<br>
-#endif<br>
+#endif // _LIBCPP_HAS_THREAD_API_PTHREAD || _LIBCPP_BUILDING_EXTERNAL_THRE<wbr>ADS<br>
<br>
 _LIBCPP_END_NAMESPACE_STD<br>
<br>
<br>
Modified: libcxx/trunk/include/thread<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/thread?rev=281179&r1=281178&r2=281179&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/libcxx/trunk/include/thr<wbr>ead?rev=281179&r1=281178&r2=28<wbr>1179&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- libcxx/trunk/include/thread (original)<br>
+++ libcxx/trunk/include/thread Sun Sep 11 16:46:40 2016<br>
@@ -137,7 +137,7 @@ public:<br>
 template <class _Tp><br>
 class __thread_specific_ptr<br>
 {<br>
-    __libcpp_tl_key __key_;<br>
+    __libcpp_tls_key __key_;<br>
<br>
      // Only __thread_local_data() may construct a __thread_specific_ptr<br>
      // and only with _Tp == __thread_struct.<br>
@@ -155,7 +155,7 @@ public:<br>
     ~__thread_specific_ptr();<br>
<br>
     _LIBCPP_INLINE_VISIBILITY<br>
-    pointer get() const {return static_cast<_Tp*>(__libcpp_tl_<wbr>get(__key_));}<br>
+    pointer get() const {return static_cast<_Tp*>(__libcpp_tls<wbr>_get(__key_));}<br>
     _LIBCPP_INLINE_VISIBILITY<br>
     pointer operator*() const {return *get();}<br>
     _LIBCPP_INLINE_VISIBILITY<br>
@@ -173,7 +173,7 @@ __thread_specific_ptr<_Tp>::__<wbr>at_thread_<br>
 template <class _Tp><br>
 __thread_specific_ptr<_Tp>::_<wbr>_thread_specific_ptr()<br>
 {<br>
-    int __ec = __libcpp_tl_create(<br>
+    int __ec = __libcpp_tls_create(<br>
         &__key_,<br>
         &__thread_specific_ptr::__at_<wbr>thread_exit);<br>
     if (__ec)<br>
@@ -196,7 +196,7 @@ __thread_specific_ptr<_Tp>::se<wbr>t_pointer(<br>
 {<br>
     _LIBCPP_ASSERT(get() == nullptr,<br>
                    "Attempting to overwrite thread local data");<br>
-    __libcpp_tl_set(__key_, __p);<br>
+    __libcpp_tls_set(__key_, __p);<br>
 }<br>
<br>
 class _LIBCPP_TYPE_VIS thread;<br>
<br>
Modified: libcxx/trunk/lib/CMakeLists.tx<wbr>t<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/lib/CMakeLists.txt?rev=281179&r1=281178&r2=281179&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/libcxx/trunk/lib/CMakeLi<wbr>sts.txt?rev=281179&r1=281178&r<wbr>2=281179&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- libcxx/trunk/lib/CMakeLists.tx<wbr>t (original)<br>
+++ libcxx/trunk/lib/CMakeLists.tx<wbr>t Sun Sep 11 16:46:40 2016<br>
@@ -201,6 +201,23 @@ if (LIBCXX_ENABLE_EXPERIMENTAL_LI<wbr>BRARY)<br>
   )<br>
 endif()<br>
<br>
+if (LIBCXX_HAS_EXTERNAL_THREAD_AP<wbr>I)<br>
+  file(GLOB LIBCXX_EXTERNAL_THREADING_SUPP<wbr>ORT_SOURCES ../test/support/external_threa<wbr>ds.cpp)<br>
+<br>
+  if (LIBCXX_ENABLE_SHARED)<br>
+    add_library(cxx_external_threa<wbr>ds SHARED ${LIBCXX_EXTERNAL_THREADING_SU<wbr>PPORT_SOURCES})<br>
+  else()<br>
+    add_library(cxx_external_threa<wbr>ds STATIC ${LIBCXX_EXTERNAL_THREADING_SU<wbr>PPORT_SOURCES})<br>
+  endif()<br>
+<br>
+  set_target_properties(cxx_exte<wbr>rnal_threads<br>
+    PROPERTIES<br>
+      LINK_FLAGS    "${LIBCXX_LINK_FLAGS}"<br>
+      COMPILE_FLAGS "${LIBCXX_COMPILE_FLAGS}"<br>
+      OUTPUT_NAME   "c++external_threads"<br>
+  )<br>
+endif()<br>
+<br>
 # Generate a linker script inplace of a libc++.so symlink. Rerun this command<br>
 # after cxx builds.<br>
 if (LIBCXX_ENABLE_SHARED AND LIBCXX_ENABLE_ABI_LINKER_SCRIP<wbr>T)<br>
<br>
Modified: libcxx/trunk/test/CMakeLists.t<wbr>xt<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/CMakeLists.txt?rev=281179&r1=281178&r2=281179&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/libcxx/trunk/test/CMakeL<wbr>ists.txt?rev=281179&r1=281178&<wbr>r2=281179&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- libcxx/trunk/test/CMakeLists.t<wbr>xt (original)<br>
+++ libcxx/trunk/test/CMakeLists.t<wbr>xt Sun Sep 11 16:46:40 2016<br>
@@ -22,6 +22,7 @@ pythonize_bool(LIBCXXABI_ENABL<wbr>E_SHARED)<br>
 pythonize_bool(LIBCXXABI_USE_<wbr>LLVM_UNWINDER)<br>
 pythonize_bool(LIBCXX_HAS_ATO<wbr>MIC_LIB)<br>
 pythonize_bool(LIBCXX_HAVE_CX<wbr>X_ATOMICS_WITH_LIB)<br>
+pythonize_bool(LIBCXX_HAS_EXT<wbr>ERNAL_THREAD_API)<br>
<br>
 # The tests shouldn't link to any ABI library when it has been linked into<br>
 # libc++ statically or via a linker script.<br>
@@ -52,10 +53,14 @@ if (LIBCXX_ENABLE_EXPERIMENTAL_LI<wbr>BRARY)<br>
   set(experimental_dep cxx_experimental)<br>
 endif()<br>
<br>
+if (LIBCXX_HAS_EXTERNAL_THREAD_AP<wbr>I)<br>
+  set(external_threads_dep cxx_external_threads)<br>
+endif()<br>
+<br>
 add_lit_testsuite(check-cxx<br>
   "Running libcxx tests"<br>
   ${CMAKE_CURRENT_BINARY_DIR}<br>
-  DEPENDS cxx ${experimental_dep})<br>
+  DEPENDS cxx ${experimental_dep} ${external_threads_dep})<br>
<br>
 add_custom_target(check-libcx<wbr>x DEPENDS check-cxx)<br>
<br>
<br>
Modified: libcxx/trunk/test/libcxx/test/<wbr>config.py<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/test/config.py?rev=281179&r1=281178&r2=281179&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/libcxx/trunk/test/libcxx<wbr>/test/config.py?rev=281179&r1=<wbr>281178&r2=281179&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- libcxx/trunk/test/libcxx/test/<wbr>config.py (original)<br>
+++ libcxx/trunk/test/libcxx/test/<wbr>config.py Sun Sep 11 16:46:40 2016<br>
@@ -510,6 +510,10 @@ class Configuration(object):<br>
                 self.cxx.link_flags += [abs_path]<br>
             else:<br>
                 self.cxx.link_flags += ['-lc++']<br>
+        # This needs to come after -lc++ as we want its unresolved thread-api symbols<br>
+        # to be picked up from this one.<br>
+        if self.get_lit_bool('libcxx_exte<wbr>rnal_thread_api', default=False):<br>
+            self.cxx.link_flags += ['-lc++external_threads']<br>
<br>
     def configure_link_flags_abi_libra<wbr>ry(self):<br>
         cxx_abi = self.get_lit_conf('cxx_abi', 'libcxxabi')<br>
<br>
Modified: libcxx/trunk/test/libcxx/threa<wbr>d/thread.condition/thread.cond<wbr>ition.condvar/native_handle.<wbr>pass.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/thread/thread.condition/thread.condition.condvar/native_handle.pass.cpp?rev=281179&r1=281178&r2=281179&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/libcxx/trunk/test/libcxx<wbr>/thread/thread.condition/threa<wbr>d.condition.condvar/native_<wbr>handle.pass.cpp?rev=281179&r1=<wbr>281178&r2=281179&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- libcxx/trunk/test/libcxx/threa<wbr>d/thread.condition/thread.cond<wbr>ition.condvar/native_handle.<wbr>pass.cpp (original)<br>
+++ libcxx/trunk/test/libcxx/threa<wbr>d/thread.condition/thread.cond<wbr>ition.condvar/native_handle.<wbr>pass.cpp Sun Sep 11 16:46:40 2016<br>
@@ -7,7 +7,7 @@<br>
 //<br>
 //===------------------------<wbr>------------------------------<wbr>----------------===//<br>
 //<br>
-// UNSUPPORTED: libcpp-has-no-threads<br>
+// UNSUPPORTED: libcpp-has-no-threads, libcpp-has-thread-api-external<br>
<br>
 // <condition_variable><br>
<br>
<br>
Modified: libcxx/trunk/test/libcxx/threa<wbr>d/thread.mutex/<a href="http://thread.mutex.re">thread.mutex.re</a><wbr>quirements/thread.mutex.requir<wbr>ements.mutex/thread.mutex.<wbr>class/native_handle.pass.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/native_handle.pass.cpp?rev=281179&r1=281178&r2=281179&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/libcxx/trunk/test/libcxx<wbr>/thread/thread.mutex/thread.mu<wbr>tex.requirements/thread.mutex.<wbr>requirements.mutex/thread.<wbr>mutex.class/native_handle.<wbr>pass.cpp?rev=281179&r1=281178&<wbr>r2=281179&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- libcxx/trunk/test/libcxx/threa<wbr>d/thread.mutex/<a href="http://thread.mutex.re">thread.mutex.re</a><wbr>quirements/thread.mutex.requir<wbr>ements.mutex/thread.mutex.<wbr>class/native_handle.pass.cpp (original)<br>
+++ libcxx/trunk/test/libcxx/threa<wbr>d/thread.mutex/<a href="http://thread.mutex.re">thread.mutex.re</a><wbr>quirements/thread.mutex.requir<wbr>ements.mutex/thread.mutex.<wbr>class/native_handle.pass.cpp Sun Sep 11 16:46:40 2016<br>
@@ -7,7 +7,7 @@<br>
 //<br>
 //===------------------------<wbr>------------------------------<wbr>----------------===//<br>
 //<br>
-// UNSUPPORTED: libcpp-has-no-threads<br>
+// UNSUPPORTED: libcpp-has-no-threads, libcpp-has-thread-api-external<br>
<br>
 // <mutex><br>
<br>
<br>
Modified: libcxx/trunk/test/libcxx/threa<wbr>d/thread.mutex/<a href="http://thread.mutex.re">thread.mutex.re</a><wbr>quirements/thread.mutex.requir<wbr>ements.mutex/thread.mutex.<wbr>recursive/native_handle.pass.<wbr>cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.recursive/native_handle.pass.cpp?rev=281179&r1=281178&r2=281179&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/libcxx/trunk/test/libcxx<wbr>/thread/thread.mutex/thread.mu<wbr>tex.requirements/thread.mutex.<wbr>requirements.mutex/thread.<wbr>mutex.recursive/native_handle.<wbr>pass.cpp?rev=281179&r1=281178&<wbr>r2=281179&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- libcxx/trunk/test/libcxx/threa<wbr>d/thread.mutex/<a href="http://thread.mutex.re">thread.mutex.re</a><wbr>quirements/thread.mutex.requir<wbr>ements.mutex/thread.mutex.<wbr>recursive/native_handle.pass.<wbr>cpp (original)<br>
+++ libcxx/trunk/test/libcxx/threa<wbr>d/thread.mutex/<a href="http://thread.mutex.re">thread.mutex.re</a><wbr>quirements/thread.mutex.requir<wbr>ements.mutex/thread.mutex.<wbr>recursive/native_handle.pass.<wbr>cpp Sun Sep 11 16:46:40 2016<br>
@@ -7,7 +7,7 @@<br>
 //<br>
 //===------------------------<wbr>------------------------------<wbr>----------------===//<br>
 //<br>
-// UNSUPPORTED: libcpp-has-no-threads<br>
+// UNSUPPORTED: libcpp-has-no-threads, libcpp-has-thread-api-external<br>
<br>
 // <mutex><br>
<br>
<br>
Modified: libcxx/trunk/test/libcxx/threa<wbr>d/thread.threads/thread.thread<wbr>.class/thread.thread.member/na<wbr>tive_handle.pass.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/thread/thread.threads/thread.thread.class/thread.thread.member/native_handle.pass.cpp?rev=281179&r1=281178&r2=281179&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/libcxx/trunk/test/libcxx<wbr>/thread/thread.threads/thread.<wbr>thread.class/thread.thread.mem<wbr>ber/native_handle.pass.cpp?rev<wbr>=281179&r1=281178&r2=281179&<wbr>view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- libcxx/trunk/test/libcxx/threa<wbr>d/thread.threads/thread.thread<wbr>.class/thread.thread.member/na<wbr>tive_handle.pass.cpp (original)<br>
+++ libcxx/trunk/test/libcxx/threa<wbr>d/thread.threads/thread.thread<wbr>.class/thread.thread.member/na<wbr>tive_handle.pass.cpp Sun Sep 11 16:46:40 2016<br>
@@ -7,7 +7,7 @@<br>
 //<br>
 //===------------------------<wbr>------------------------------<wbr>----------------===//<br>
 //<br>
-// UNSUPPORTED: libcpp-has-no-threads<br>
+// UNSUPPORTED: libcpp-has-no-threads, libcpp-has-thread-api-external<br>
<br>
 // <thread><br>
<br>
<br>
Modified: libcxx/trunk/test/libcxx/threa<wbr>d/thread.threads/thread.thread<wbr>.class/types.pass.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/thread/thread.threads/thread.thread.class/types.pass.cpp?rev=281179&r1=281178&r2=281179&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/libcxx/trunk/test/libcxx<wbr>/thread/thread.threads/thread.<wbr>thread.class/types.pass.cpp?re<wbr>v=281179&r1=281178&r2=281179&<wbr>view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- libcxx/trunk/test/libcxx/threa<wbr>d/thread.threads/thread.thread<wbr>.class/types.pass.cpp (original)<br>
+++ libcxx/trunk/test/libcxx/threa<wbr>d/thread.threads/thread.thread<wbr>.class/types.pass.cpp Sun Sep 11 16:46:40 2016<br>
@@ -7,7 +7,7 @@<br>
 //<br>
 //===------------------------<wbr>------------------------------<wbr>----------------===//<br>
 //<br>
-// UNSUPPORTED: libcpp-has-no-threads<br>
+// UNSUPPORTED: libcpp-has-no-threads, libcpp-has-thread-api-external<br>
<br>
 // <thread><br>
<br>
<br>
Modified: libcxx/trunk/test/<a href="http://lit.site.cfg.in" rel="noreferrer" target="_blank">lit.site.cfg<wbr>.in</a><br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/lit.site.cfg.in?rev=281179&r1=281178&r2=281179&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/libcxx/trunk/test/lit.si<wbr>te.cfg.in?rev=281179&r1=281178<wbr>&r2=281179&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- libcxx/trunk/test/<a href="http://lit.site.cfg.in" rel="noreferrer" target="_blank">lit.site.cfg<wbr>.in</a> (original)<br>
+++ libcxx/trunk/test/<a href="http://lit.site.cfg.in" rel="noreferrer" target="_blank">lit.site.cfg<wbr>.in</a> Sun Sep 11 16:46:40 2016<br>
@@ -26,6 +26,7 @@ config.has_libatomic            = "@LIBC<br>
 config.use_libatomic            = "@LIBCXX_HAVE_CXX_ATOMICS_WITH<wbr>_LIB@"<br>
<br>
 config.libcxxabi_shared         = "@LIBCXXABI_ENABLE_SHARED@"<br>
+config.libcxx_external_thread<wbr>_api  = "@LIBCXX_HAS_EXTERNAL_THREAD_A<wbr>PI@"<br>
<br>
 # Let the main config do the real work.<br>
 lit_config.load_config(config<wbr>, "@LIBCXX_SOURCE_DIR@/test/lit.<wbr>cfg")<br>
<br>
Copied: libcxx/trunk/test/support/exte<wbr>rnal_threads.cpp (from r280988, libcxx/trunk/test/libcxx/threa<wbr>d/thread.mutex/<a href="http://thread.mutex.re">thread.mutex.re</a><wbr>quirements/thread.mutex.requir<wbr>ements.mutex/thread.mutex.<wbr>class/native_handle.pass.cpp)<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/external_threads.cpp?p2=libcxx/trunk/test/support/external_threads.cpp&p1=libcxx/trunk/test/libcxx/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/native_handle.pass.cpp&r1=280988&r2=281179&rev=281179&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/libcxx/trunk/test/suppor<wbr>t/external_threads.cpp?p2=libc<wbr>xx/trunk/test/support/external<wbr>_threads.cpp&p1=libcxx/trunk/<wbr>test/libcxx/thread/thread.<wbr>mutex/thread.mutex.requirement<wbr>s/thread.mutex.requirements.<wbr>mutex/thread.mutex.class/<wbr>native_handle.pass.cpp&r1=<wbr>280988&r2=281179&rev=281179&<wbr>view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- libcxx/trunk/test/libcxx/threa<wbr>d/thread.mutex/<a href="http://thread.mutex.re">thread.mutex.re</a><wbr>quirements/thread.mutex.requir<wbr>ements.mutex/thread.mutex.<wbr>class/native_handle.pass.cpp (original)<br>
+++ libcxx/trunk/test/support/exte<wbr>rnal_threads.cpp Sun Sep 11 16:46:40 2016<br>
@@ -6,22 +6,5 @@<br>
 // Source Licenses. See LICENSE.TXT for details.<br>
 //<br>
 //===------------------------<wbr>------------------------------<wbr>----------------===//<br>
-//<br>
-// UNSUPPORTED: libcpp-has-no-threads<br>
-<br>
-// <mutex><br>
-<br>
-// class mutex;<br>
-<br>
-// typedef pthread_mutex_t* native_handle_type;<br>
-// native_handle_type native_handle();<br>
-<br>
-#include <mutex><br>
-#include <cassert><br>
-<br>
-int main()<br>
-{<br>
-    std::mutex m;<br>
-    pthread_mutex_t* h = m.native_handle();<br>
-    assert(h);<br>
-}<br>
+#define _LIBCPP_BUILDING_EXTERNAL_THRE<wbr>ADS<br>
+#include <__threading_support><br>
<br>
<br>
______________________________<wbr>_________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-commits</a><br>
</blockquote></div></div></div><span><font color="#888888"><div dir="ltr">-- <br></div><div data-smartmail="gmail_signature"><div dir="ltr">Mike<br>Sent from phone</div></div>
</font></span><br>______________________________<wbr>_________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-commits</a><br>
<br></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>