Skip to content

Commit 14aef53

Browse files
committed
[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
1 parent 59fb9cd commit 14aef53

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

libcxx/include/__threading_support

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -264,16 +264,6 @@ void __libcpp_thread_yield();
264264
_LIBCPP_THREAD_ABI_VISIBILITY
265265
void __libcpp_thread_sleep_for(const chrono::nanoseconds& __ns);
266266

267-
struct __libcpp_timed_backoff_policy {
268-
_LIBCPP_THREAD_ABI_VISIBILITY
269-
bool operator()(chrono::nanoseconds __elapsed) const;
270-
};
271-
272-
template<class _Fn, class _BFn>
273-
_LIBCPP_INLINE_VISIBILITY
274-
bool __libcpp_thread_poll_with_backoff(
275-
_Fn && __f, _BFn && __bf, chrono::nanoseconds __max_elapsed = chrono::nanoseconds::zero());
276-
277267
// Thread local storage
278268
_LIBCPP_THREAD_ABI_VISIBILITY
279269
int __libcpp_tls_create(__libcpp_tls_key* __key,
@@ -290,6 +280,16 @@ int __libcpp_tls_set(__libcpp_tls_key __key, void *__p);
290280
#if (!defined(_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL) || \
291281
defined(_LIBCPP_BUILDING_THREAD_LIBRARY_EXTERNAL))
292282

283+
struct __libcpp_timed_backoff_policy {
284+
_LIBCPP_THREAD_ABI_VISIBILITY
285+
bool operator()(chrono::nanoseconds __elapsed) const;
286+
};
287+
288+
template<class _Fn, class _BFn>
289+
_LIBCPP_INLINE_VISIBILITY
290+
bool __libcpp_thread_poll_with_backoff(
291+
_Fn && __f, _BFn && __bf, chrono::nanoseconds __max_elapsed = chrono::nanoseconds::zero());
292+
293293
namespace __thread_detail {
294294

295295
inline __libcpp_timespec_t __convert_to_timespec(const chrono::nanoseconds& __ns)

0 commit comments

Comments
 (0)