[libcxx-commits] [PATCH] D64378: [libcxx] Use C11 thread API on Fuchsia

Eric Fiselier via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jul 8 20:24:25 PDT 2019


EricWF added inline comments.


================
Comment at: libcxx/include/__config:1115
 // as well.
-#if defined(_LIBCPP_HAS_THREAD_API_WIN32)
+#if defined(_LIBCPP_HAS_THREAD_API_FUCHSIA) || \
+    defined(_LIBCPP_HAS_THREAD_API_WIN32)
----------------
After switching to the `_LIBCPP_HAS_THREAD_API_C11` this check should include `_LIBCPP_HAS_MUSL_LIBC`, because AFAIK, the trivial destruction property is an implementation detail of MUSL.


================
Comment at: libcxx/include/__threading_support:31
+#elif defined(_LIBCPP_HAS_THREAD_API_FUCHSIA)
+# define _ALL_SOURCE 1
+# include <threads.h>
----------------
EricWF wrote:
> jfb wrote:
> > What does this do? Docs say "Enable extensions for AIX 3, and for Interix."
> What happens when `threads.h` is included before any libc++ headers?
> We might have to lift this define into the compiler, like we've had to do with `_GNU_SOURCE`.
After some searching, I'm assuming the libc Fucshia uses is MUSL?

If so, then `MTX_INIT` is defined as simply `{}`. Writing that in source is going to be less problematic than ensuring `_ALL_SOURCE` is always defined.


================
Comment at: libcxx/include/__threading_support:565
+  typedef decltype(__ts.tv_sec) ts_sec;
+  _LIBCPP_CONSTEXPR ts_sec __ts_sec_max = numeric_limits<ts_sec>::max();
+
----------------
Just use `const` here, it has the same effect but it works in C++03. 


Repository:
  rCXX libc++

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D64378/new/

https://reviews.llvm.org/D64378





More information about the libcxx-commits mailing list