aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2019-11-16 21:47:28 +0000
committerJonathan Wakely <redi@gcc.gnu.org>2019-11-16 21:47:28 +0000
commit7453376403450b757b10b3d37b52b5db1f5c8d30 (patch)
tree2282726fd3424c934787eba1232b9fed2279900a /gcc
parent970a9bfaadcca4489613ca76a1800a32d1a93e14 (diff)
downloadgcc-7453376403450b757b10b3d37b52b5db1f5c8d30.zip
gcc-7453376403450b757b10b3d37b52b5db1f5c8d30.tar.gz
gcc-7453376403450b757b10b3d37b52b5db1f5c8d30.tar.bz2
libstdc++: Optimize std::jthread construction
This change avoids storing a copy of a stop_token object that isn't needed and won't be passed to the callable object. This slightly reduces memory usage when the callable doesn't use a stop_token. It also removes indirection in the invocation of the callable in the new thread, as there is no lambda and no additional calls to std::invoke. It also adds some missing [[nodiscard]] attributes, and the non-member swap overload for std::jthread. * include/std/thread (jthread::jthread()): Use nostopstate constant. (jthread::jthread(Callable&&, Args&&...)): Use helper function to create std::thread instead of indirection through a lambda. Use remove_cvref_t instead of decay_t. (jthread::joinable(), jthread::get_id(), jthread::native_handle()) (jthread::hardware_concurrency()): Add nodiscard attribute. (swap(jthread&. jthread&)): Define hidden friend. (jthread::_S_create): New helper function for constructor. From-SVN: r278364
Diffstat (limited to 'gcc')
0 files changed, 0 insertions, 0 deletions