gcc/libstdc++-v3/testsuite
Mike Crowe b9faa3301c libstdc++: Loop when futex waits against arbitrary clock
If std::future::wait_until is passed a time point measured against a
clock that is neither std::chrono::steady_clock nor
std::chrono::system_clock then the generic implementation of
__atomic_futex_unsigned::_M_load_when_equal_until is called which
calculates the timeout based on __clock_t and calls the
_M_load_when_equal_until method for that clock to perform the actual
wait.

There's no guarantee that __clock_t is running at the same speed as the
caller's clock, so if the underlying wait times out timeout we need to
check the timeout against the caller's clock again before potentially
looping.

Also add two extra tests to the testsuite's async.cc:

* run test03 with steady_clock_copy, which behaves identically to
  chrono::steady_clock, but isn't chrono::steady_clock. This causes
  the overload of __atomic_futex_unsigned::_M_load_when_equal_until
  that takes an arbitrary clock to be called.

* invent test04 which uses a deliberately slow running clock in order
  to exercise the looping behaviour of
  __atomic_futex_unsigned::_M_load_when_equal_until described above.

libstdc++-v3/ChangeLog:

	* include/bits/atomic_futex.h
	(__atomic_futex_unsigned::_M_load_when_equal_until): Add
	loop on generic _Clock to check the timeout against _Clock
	again after _M_load_when_equal_until returns indicating a
	timeout.
	* testsuite/30_threads/async/async.cc: Invent slow_clock
	that runs at an eleventh of steady_clock's speed. Use it
	to test the user-supplied-clock variant of
	__atomic_futex_unsigned::_M_load_when_equal_until works
	generally with test03 and loops correctly when the timeout
	time hasn't been reached in test04.
2020-09-11 14:28:50 +01:00
..
17_intro libstdc++: Do not check "cold" name on darwin [PR 96736] 2020-08-21 18:24:40 +01:00
18_support libstdc++: Break header cycle between <new> and <exception> 2020-09-02 13:56:32 +01:00
19_diagnostics libstdc++: Ensure c++NN effective target present in all C++17 tests 2020-07-31 19:58:02 +01:00
20_util libstdc++: handle small max_blocks_per_chunk in pool resources [PR 94160] 2020-09-10 15:42:09 +01:00
21_strings libstdc++: Remove tests for self-move debug assertions 2020-08-25 16:36:01 +01:00
22_locale Update copyright years. 2020-01-01 12:51:42 +01:00
23_containers libstdc++: Fix three-way comparison for std::array [PR 96851] 2020-09-02 15:32:11 +01:00
24_iterators libstdc++: Fix std::indirectly_readable ambiguity [LWG 3446] 2020-08-24 16:18:31 +01:00
25_algorithms libstdc++: Skip PSTL tests when installed TBB is too old [PR 96718] 2020-08-21 12:01:05 +01:00
26_numerics libstdc++: Optimise GCD algorithms 2020-09-03 12:46:13 +01:00
27_io libstdc++: Add deprecated attributes to old iostream members 2020-08-19 12:13:23 +01:00
28_regex libstdc++: Ensure c++NN effective-target present in more tests 2020-07-31 19:58:03 +01:00
29_atomics libstdc++: Ensure c++NN effective target present in all C++17 tests 2020-07-31 19:58:02 +01:00
30_threads libstdc++: Loop when futex waits against arbitrary clock 2020-09-11 14:28:50 +01:00
abi Update copyright years. 2020-01-01 12:51:42 +01:00
backward Update copyright years. 2020-01-01 12:51:42 +01:00
config Update copyright years. 2020-01-01 12:51:42 +01:00
data
decimal Update copyright years. 2020-01-01 12:51:42 +01:00
experimental libstdc++: Optimise GCD algorithms 2020-09-03 12:46:13 +01:00
ext libstdc++: Avoid errors in allocator's noexcept-specifier (PR 89510) 2020-04-30 16:01:43 +01:00
lib diagnostics: Add new option -fdiagnostics-plain-output 2020-08-14 09:29:19 -04:00
libstdc++-abi Update copyright years. 2020-01-01 12:51:42 +01:00
libstdc++-dg Update copyright years. 2020-01-01 12:51:42 +01:00
libstdc++-prettyprinters libstdc++: Remove inheritance from elements in std::tuple 2020-08-17 15:27:51 +01:00
libstdc++-xmethods Update copyright years. 2020-01-01 12:51:42 +01:00
performance Update copyright years. 2020-01-01 12:51:42 +01:00
special_functions Update copyright years. 2020-01-01 12:51:42 +01:00
std libstdc++: Fix arithmetic bug in chrono::year_month::operator+ 2020-08-27 14:11:24 -04:00
tr1 libstdc++: Ensure c++NN effective-target present in more tests 2020-07-31 19:58:03 +01:00
tr2 Update copyright years. 2020-01-01 12:51:42 +01:00
util libstdc++: Make testsuite usable with -fno-exceptions 2020-07-30 12:50:02 +01:00
Makefile.am libstdc++: Enable simple invocation of runtest in testsuite 2020-05-21 14:16:19 +01:00
Makefile.in libstdc++: Regenerate makefiles 2020-06-23 07:59:40 +01:00