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
Name |
Last commit
|
Last update |
---|---|---|
.. | ||
algorithm | Loading commit data... | |
any | Loading commit data... | |
array | Loading commit data... | |
atomic | Loading commit data... | |
bit | Loading commit data... | |
bitset | Loading commit data... | |
charconv | Loading commit data... | |
chrono | Loading commit data... | |
codecvt | Loading commit data... | |
complex | Loading commit data... | |
concepts | Loading commit data... | |
condition_variable | Loading commit data... | |
deque | Loading commit data... | |
execution | Loading commit data... | |
filesystem | Loading commit data... | |
forward_list | Loading commit data... | |
fstream | Loading commit data... | |
functional | Loading commit data... | |
future | Loading commit data... | |
iomanip | Loading commit data... | |
ios | Loading commit data... | |
iosfwd | Loading commit data... | |
iostream | Loading commit data... | |
istream | Loading commit data... | |
iterator | Loading commit data... | |
limits | Loading commit data... | |
list | Loading commit data... | |
locale | Loading commit data... | |
map | Loading commit data... | |
memory | Loading commit data... | |
memory_resource | Loading commit data... | |
mutex | Loading commit data... | |
numbers | Loading commit data... | |
numeric | Loading commit data... | |
optional | Loading commit data... | |
ostream | Loading commit data... | |
queue | Loading commit data... | |
random | Loading commit data... | |
ranges | Loading commit data... | |
ratio | Loading commit data... | |
regex | Loading commit data... | |
scoped_allocator | Loading commit data... | |
set | Loading commit data... | |
shared_mutex | Loading commit data... | |
span | Loading commit data... | |
sstream | Loading commit data... | |
stack | Loading commit data... | |
stdexcept | Loading commit data... | |
stop_token | Loading commit data... | |
streambuf | Loading commit data... | |
string | Loading commit data... | |
string_view | Loading commit data... | |
system_error | Loading commit data... | |
thread | Loading commit data... | |
tuple | Loading commit data... | |
type_traits | Loading commit data... | |
typeindex | Loading commit data... | |
unordered_map | Loading commit data... | |
unordered_set | Loading commit data... | |
utility | Loading commit data... | |
valarray | Loading commit data... | |
variant | Loading commit data... | |
vector | Loading commit data... | |
version | Loading commit data... |