[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
This commit is contained in:
Mikhail Maltsev 2020-02-26 17:54:43 +00:00
parent 59fb9cde7a
commit 14aef5367d
1 changed files with 10 additions and 10 deletions

View File

@ -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)