summaryrefslogtreecommitdiffstats
path: root/contrib/libs/cxxsupp/libcxx/include/__threading_support
diff options
context:
space:
mode:
authorarcadia-devtools <[email protected]>2022-03-01 14:07:11 +0300
committerarcadia-devtools <[email protected]>2022-03-01 14:07:11 +0300
commit2ec7758a9f5564266f5736c249c02d15d8316246 (patch)
tree5fa4cc3fb88d1a1aca0cb65d7e0eb0c710f358ce /contrib/libs/cxxsupp/libcxx/include/__threading_support
parent6e8c5376d75151b514477715c1b9505d017b83eb (diff)
intermediate changes
ref:ca7f4ea59c35451f4846b211a4122df6ab12b4df
Diffstat (limited to 'contrib/libs/cxxsupp/libcxx/include/__threading_support')
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__threading_support24
1 files changed, 1 insertions, 23 deletions
diff --git a/contrib/libs/cxxsupp/libcxx/include/__threading_support b/contrib/libs/cxxsupp/libcxx/include/__threading_support
index 7bf2363d20e..9f70ad18b4d 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__threading_support
+++ b/contrib/libs/cxxsupp/libcxx/include/__threading_support
@@ -12,6 +12,7 @@
#include <__availability>
#include <__config>
+#include <__thread/poll_with_backoff.h>
#include <chrono>
#include <errno.h>
#include <iosfwd>
@@ -269,29 +270,6 @@ struct __libcpp_timed_backoff_policy {
}
};
-static _LIBCPP_CONSTEXPR const int __libcpp_polling_count = 64;
-
-template<class _Fn, class _BFn>
-_LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY
-bool __libcpp_thread_poll_with_backoff(
- _Fn && __f, _BFn && __bf, chrono::nanoseconds __max_elapsed = chrono::nanoseconds::zero())
-{
- auto const __start = chrono::high_resolution_clock::now();
- for(int __count = 0;;) {
- if(__f())
- return true; // _Fn completion means success
- if(__count < __libcpp_polling_count) {
- __count += 1;
- continue;
- }
- chrono::nanoseconds const __elapsed = chrono::high_resolution_clock::now() - __start;
- if(__max_elapsed != chrono::nanoseconds::zero() && __max_elapsed < __elapsed)
- return false; // timeout failure
- if(__bf(__elapsed))
- return false; // _BFn completion means failure
- }
-}
-
#if (!defined(_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL) || \
defined(_LIBCPP_BUILDING_THREAD_LIBRARY_EXTERNAL))