[libcxx-commits] [PATCH] D75191: [libcxx] Fix _LIBCPP_HAS_THREAD_API_EXTERNAL build

Mikhail Maltsev via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Feb 26 09:00:39 PST 2020


miyuki created this revision.
miyuki added reviewers: ldionne, __simt__.
Herald added a reviewer: EricWF.
Herald added subscribers: libcxx-commits, dexonsmith.
Herald added a project: libc++.

The definition of `__libcpp_timed_backoff_policy` and the declaration of
`__libcpp_thread_poll_with_backoff` must not be guarded by

  #if !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)

because the definitions of `__libcpp_timed_backoff_policy::operator()`
and `__libcpp_thread_poll_with_backoff` aren't guarded by this macro
(and this is correct because these two functions are implemented in
terms of other libc++ functions and don't interact with the host
threading library).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D75191

Files:
  libcxx/include/__threading_support


Index: libcxx/include/__threading_support
===================================================================
--- libcxx/include/__threading_support
+++ libcxx/include/__threading_support
@@ -264,16 +264,6 @@
 _LIBCPP_THREAD_ABI_VISIBILITY
 void __libcpp_thread_sleep_for(const chrono::nanoseconds& __ns);
 
-struct __libcpp_timed_backoff_policy {
-  _LIBCPP_THREAD_ABI_VISIBILITY
-  bool operator()(chrono::nanoseconds __elapsed) const;
-};
-
-template<class _Fn, class _BFn>
-_LIBCPP_INLINE_VISIBILITY
-bool __libcpp_thread_poll_with_backoff(
-  _Fn && __f, _BFn && __bf, chrono::nanoseconds __max_elapsed = chrono::nanoseconds::zero());
-
 // Thread local storage
 _LIBCPP_THREAD_ABI_VISIBILITY
 int __libcpp_tls_create(__libcpp_tls_key* __key,
@@ -290,6 +280,16 @@
 #if (!defined(_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL) || \
      defined(_LIBCPP_BUILDING_THREAD_LIBRARY_EXTERNAL))
 
+struct __libcpp_timed_backoff_policy {
+  _LIBCPP_THREAD_ABI_VISIBILITY
+  bool operator()(chrono::nanoseconds __elapsed) const;
+};
+
+template<class _Fn, class _BFn>
+_LIBCPP_INLINE_VISIBILITY
+bool __libcpp_thread_poll_with_backoff(
+  _Fn && __f, _BFn && __bf, chrono::nanoseconds __max_elapsed = chrono::nanoseconds::zero());
+
 namespace __thread_detail {
 
 inline __libcpp_timespec_t __convert_to_timespec(const chrono::nanoseconds& __ns)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75191.246752.patch
Type: text/x-patch
Size: 1333 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20200226/468ad8d1/attachment.bin>


More information about the libcxx-commits mailing list