gcc/libstdc++-v3/testsuite/30_threads
Jonathan Wakely ebc464940d libstdc++: Fix std::jthread bugs
The std::jthread::get_id() function was missing a return statement.

The is_invocable check needs to be done using decayed types, as they'll
be forwarded to std::invoke as rvalues.

Also reduce header dependencies for the <thread> header. We don't need
to include <functional> for std::jthread because <bits/invoke.h> is
already included, which defines std::__invoke. We can also remove
<bits/functexcept.h> which isn't used at all. Finally, when
_GLIBCXX_HAS_GTHREADS is not defined there's no point including any
other headers, since we're not going to define anything in <thread>
anyway.

	* include/std/thread: Reduce header dependencies.
	(jthread::get_id()): Add missing return.
	(jthread::get_stop_token()): Avoid unnecessary stop_source temporary.
	(jthread::_S_create): Check is_invocable using decayed types. Add
	static assertion.
	* testsuite/30_threads/jthread/1.cc: Add dg-require-gthreads.
	* testsuite/30_threads/jthread/2.cc: Likewise.
	* testsuite/30_threads/jthread/3.cc: New test.
	* testsuite/30_threads/jthread/jthread.cc: Add missing directives for
	pthread and gthread support. Use VERIFY instead of assert.

From-SVN: r278402
2019-11-18 12:46:08 +00:00
..
async
call_once
condition_variable Add user-defined clock to libstdc++ condition_variable tests 2019-09-04 23:43:20 +01:00
condition_variable_any Support for jthread and stop_token 2019-11-15 03:09:19 +00:00
future
headers libstdc++: Fix definition of std::nostopstate object 2019-11-15 14:38:59 +00:00
jthread libstdc++: Fix std::jthread bugs 2019-11-18 12:46:08 +00:00
lock
lock_guard
mutex
once_flag/cons
packaged_task
promise
recursive_mutex
recursive_timed_mutex
scoped_lock
shared_future
shared_lock
shared_mutex
shared_timed_mutex
stop_token libstdc++: Fix <stop_token> and improve tests 2019-11-15 23:44:47 +00:00
this_thread
thread
timed_mutex
try_lock
unique_lock