@@ -26,30 +26,30 @@ static _LIBCPP_CONSTEXPR const int __libcpp_polling_count = 64;
2626// Polls a thread for a condition given by a predicate, and backs off based on a backoff policy
2727// before polling again.
2828//
29- // - __f is the "test function" that should return true if polling succeeded, and false if it failed.
29+ // - __poll is the "test function" that should return true if polling succeeded, and false if it failed.
3030//
31- // - __bf is the "backoff policy", which is called with the duration since we started polling. It should
31+ // - __backoff is the "backoff policy", which is called with the duration since we started polling. It should
3232// return false in order to resume polling, and true if polling should stop entirely for some reason.
3333// In general, backoff policies sleep for some time before returning control to the polling loop.
3434//
3535// - __max_elapsed is the maximum duration to try polling for. If the maximum duration is exceeded,
3636// the polling loop will return false to report a timeout.
37- template <class _Fn , class _BFn >
37+ template <class _Poll , class _Backoff >
3838_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI bool __libcpp_thread_poll_with_backoff (
39- _Fn && __f, _BFn && __bf , chrono::nanoseconds __max_elapsed = chrono::nanoseconds::zero()) {
39+ _Poll && __poll, _Backoff && __backoff , chrono::nanoseconds __max_elapsed = chrono::nanoseconds::zero()) {
4040 auto const __start = chrono::high_resolution_clock::now ();
4141 for (int __count = 0 ;;) {
42- if (__f ())
43- return true ; // _Fn completion means success
42+ if (__poll ())
43+ return true ; // __poll completion means success
4444 if (__count < __libcpp_polling_count) {
4545 __count += 1 ;
4646 continue ;
4747 }
4848 chrono::nanoseconds const __elapsed = chrono::high_resolution_clock::now () - __start;
4949 if (__max_elapsed != chrono::nanoseconds::zero () && __max_elapsed < __elapsed)
5050 return false ; // timeout failure
51- if (__bf (__elapsed))
52- return false ; // _BFn completion means failure
51+ if (__backoff (__elapsed))
52+ return false ; // __backoff completion means failure
5353 }
5454}
5555
0 commit comments