[libc++][NFC] Define functor's call operator inline
This fixes a mismatched visibility attribute on the call operator in
addition to making the code clearer. Given this is a simple lambda
in essence, the intent has always been to give it inline visibility.
GitOrigin-RevId: 21a1a263a6d9c0c44ef8eb0744786e2aa5d59e53
diff --git a/include/__threading_support b/include/__threading_support
index 072c4c7..6501217 100644
--- a/include/__threading_support
+++ b/include/__threading_support
@@ -278,24 +278,21 @@
#endif // !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
struct __libcpp_timed_backoff_policy {
- _LIBCPP_THREAD_ABI_VISIBILITY
- bool operator()(chrono::nanoseconds __elapsed) const;
+ _LIBCPP_INLINE_VISIBILITY
+ bool operator()(chrono::nanoseconds __elapsed) const
+ {
+ if(__elapsed > chrono::milliseconds(128))
+ __libcpp_thread_sleep_for(chrono::milliseconds(8));
+ else if(__elapsed > chrono::microseconds(64))
+ __libcpp_thread_sleep_for(__elapsed / 2);
+ else if(__elapsed > chrono::microseconds(4))
+ __libcpp_thread_yield();
+ else
+ ; // poll
+ return false;
+ }
};
-inline _LIBCPP_INLINE_VISIBILITY
-bool __libcpp_timed_backoff_policy::operator()(chrono::nanoseconds __elapsed) const
-{
- if(__elapsed > chrono::milliseconds(128))
- __libcpp_thread_sleep_for(chrono::milliseconds(8));
- else if(__elapsed > chrono::microseconds(64))
- __libcpp_thread_sleep_for(__elapsed / 2);
- else if(__elapsed > chrono::microseconds(4))
- __libcpp_thread_yield();
- else
- ; // poll
- return false;
-}
-
static _LIBCPP_CONSTEXPR const int __libcpp_polling_count = 64;
template<class _Fn, class _BFn>