[libcxx-commits] [libcxx] 14aef53 - [libcxx] Fix _LIBCPP_HAS_THREAD_API_EXTERNAL build

Mikhail Maltsev via libcxx-commits libcxx-commits at lists.llvm.org
Wed Feb 26 09:54:56 PST 2020


Author: Mikhail Maltsev
Date: 2020-02-26T17:54:43Z
New Revision: 14aef5367d0dfc2ec10ffdbbc3fb8abbc530f4d1

URL: https://github.com/llvm/llvm-project/commit/14aef5367d0dfc2ec10ffdbbc3fb8abbc530f4d1
DIFF: https://github.com/llvm/llvm-project/commit/14aef5367d0dfc2ec10ffdbbc3fb8abbc530f4d1.diff

LOG: [libcxx] Fix _LIBCPP_HAS_THREAD_API_EXTERNAL build

Summary:
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).

Reviewers: ldionne, __simt__, EricWF, mclow.lists

Reviewed By: ldionne

Subscribers: dexonsmith, libcxx-commits

Tags: #libc

Differential Revision: https://reviews.llvm.org/D75191

Added: 
    

Modified: 
    libcxx/include/__threading_support

Removed: 
    


################################################################################
diff  --git a/libcxx/include/__threading_support b/libcxx/include/__threading_support
index 8dc6f11782d7..50f65fe278b7 100644
--- a/libcxx/include/__threading_support
+++ b/libcxx/include/__threading_support
@@ -264,16 +264,6 @@ void __libcpp_thread_yield();
 _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 @@ int __libcpp_tls_set(__libcpp_tls_key __key, void *__p);
 #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)


        


More information about the libcxx-commits mailing list