diff options
author | Andrey Khalyavin <[email protected]> | 2022-04-21 13:17:27 +0300 |
---|---|---|
committer | Andrey Khalyavin <[email protected]> | 2022-04-21 13:17:27 +0300 |
commit | ddddb65b4f1f643c2d11077c6af35df1d6ab1656 (patch) | |
tree | c66d94470f9e2f5840a36474a656755c0af4db20 /contrib/libs/cxxsupp/libcxx/include/__threading_support | |
parent | f818c45c008cf20b6ac46f7c5f9a0cd5095ccca3 (diff) |
Update libc++ to 429a717e (20 Jan 2022).
Notable changes:
* use _LIBCPP_DEBUG_ASSERT in unordered_map and vector headers
* use reserved identifiers for template parameters
* fix category of fs::path::iterator
* introduce __debug_db_insert_i() for debug checks to support compile-time evaluation
* add specializations of basic_common_reference and common_type for tuple
* fix std::lognormal_distribution::param_type
* add _LIBCPP_HIDE_FROM_ABI to in_in_result conversion operators
* replace _LIBCPP_INLINE_VISIBILITY with _LIBCPP_HIDE_FROM_ABI in move_iterator.h
* fix __simple_view concept in std::ranges
* add some ASCII/EBCDIC support for z/OS
ref:b0e68cbe142a3f06a8804f247119b5eb0a455a39
Diffstat (limited to 'contrib/libs/cxxsupp/libcxx/include/__threading_support')
-rw-r--r-- | contrib/libs/cxxsupp/libcxx/include/__threading_support | 53 |
1 files changed, 2 insertions, 51 deletions
diff --git a/contrib/libs/cxxsupp/libcxx/include/__threading_support b/contrib/libs/cxxsupp/libcxx/include/__threading_support index 89ea4a91698..b4675aadf07 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__threading_support +++ b/contrib/libs/cxxsupp/libcxx/include/__threading_support @@ -56,9 +56,6 @@ typedef ::timespec __libcpp_timespec_t; #endif // !defined(_LIBCPP_HAS_NO_THREADS) -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - _LIBCPP_BEGIN_NAMESPACE_STD #if !defined(_LIBCPP_HAS_NO_THREADS) @@ -254,53 +251,9 @@ int __libcpp_tls_set(__libcpp_tls_key __key, void *__p); #endif // !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL) -struct __libcpp_timed_backoff_policy { - _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; - } -}; - #if (!defined(_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL) || \ defined(_LIBCPP_BUILDING_THREAD_LIBRARY_EXTERNAL)) - -namespace __thread_detail { - -_LIBCPP_HIDE_FROM_ABI inline -__libcpp_timespec_t __convert_to_timespec(const chrono::nanoseconds& __ns) -{ - using namespace chrono; - seconds __s = duration_cast<seconds>(__ns); - __libcpp_timespec_t __ts; - typedef decltype(__ts.tv_sec) __ts_sec; - const __ts_sec __ts_sec_max = numeric_limits<__ts_sec>::max(); - - if (__s.count() < __ts_sec_max) - { - __ts.tv_sec = static_cast<__ts_sec>(__s.count()); - __ts.tv_nsec = static_cast<decltype(__ts.tv_nsec)>((__ns - __s).count()); - } - else - { - __ts.tv_sec = __ts_sec_max; - __ts.tv_nsec = 999999999; // (10^9 - 1) - } - - return __ts; -} - -} // namespace __thread_detail - #if defined(_LIBCPP_HAS_THREAD_API_PTHREAD) _LIBCPP_HIDE_FROM_ABI inline @@ -481,7 +434,7 @@ void __libcpp_thread_yield() _LIBCPP_HIDE_FROM_ABI inline void __libcpp_thread_sleep_for(const chrono::nanoseconds& __ns) { - __libcpp_timespec_t __ts = __thread_detail::__convert_to_timespec(__ns); + __libcpp_timespec_t __ts = _VSTD::__convert_to_timespec<__libcpp_timespec_t>(__ns); while (nanosleep(&__ts, &__ts) == -1 && errno == EINTR); } @@ -666,7 +619,7 @@ void __libcpp_thread_yield() _LIBCPP_HIDE_FROM_ABI inline void __libcpp_thread_sleep_for(const chrono::nanoseconds& __ns) { - __libcpp_timespec_t __ts = __thread_detail::__convert_to_timespec(__ns); + __libcpp_timespec_t __ts = _VSTD::__convert_to_timespec<__libcpp_timespec_t>(__ns); thrd_sleep(&__ts, nullptr); } @@ -778,6 +731,4 @@ get_id() _NOEXCEPT _LIBCPP_END_NAMESPACE_STD -_LIBCPP_POP_MACROS - #endif // _LIBCPP_THREADING_SUPPORT |