public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/92546] [10/11 Regression] Large increase in preprocessed file sizes in C++2a mode Date: Thu, 19 Nov 2020 13:36:26 +0000 [thread overview] Message-ID: <bug-92546-4-NGbc9aRmB4@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-92546-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92546 --- Comment #12 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>: https://gcc.gnu.org/g:b204d7722d30f44281dea3341070223475f1cff9 commit r11-5168-gb204d7722d30f44281dea3341070223475f1cff9 Author: Jonathan Wakely <jwakely@redhat.com> Date: Thu Nov 19 13:36:15 2020 +0000 libstdc++: Move std::thread to a new header This makes it possible to use std::thread without including the whole of <thread>. It also makes this_thread::get_id() and this_thread::yield() available even when there is no gthreads support (e.g. when GCC is built with --disable-threads or --enable-threads=single). In order for the std::thread::id return type of this_thread::get_id() to be defined, std:thread itself is defined unconditionally. However the constructor that creates new threads is not defined for single-threaded builds. The thread::join() and thread::detach() member functions are defined inline for single-threaded builds and just throw an exception (because we know the thread cannot be joinable if the constructor that creates joinable threads doesn't exit). The thread::hardware_concurrency() member function is also defined inline and returns 0 (as suggested by the standard when the value "is not computable or well-defined"). The main benefit for most targets is that other headers such as <future> do not need to include the whole of <thread> just to be able to create a std::thread. That avoids including <stop_token> and std::jthread where not required. This is another partial fix for PR 92546. This also means we can use this_thread::get_id() and this_thread::yield() in <stop_token> instead of using the gthread functions directly. This removes some preprocessor conditionals, simplifying the code. libstdc++-v3/ChangeLog: PR libstdc++/92546 * include/Makefile.am: Add new <bits/std_thread.h> header. * include/Makefile.in: Regenerate. * include/std/future: Include new header instead of <thread>. * include/std/stop_token: Include new header instead of <bits/gthr.h>. (stop_token::_S_yield()): Use this_thread::yield(). (_Stop_state_t::_M_requester): Change type to std::thread::id. (_Stop_state_t::_M_request_stop()): Use this_thread::get_id(). (_Stop_state_t::_M_remove_callback(_Stop_cb*)): Likewise. Use __is_single_threaded() to decide whether to synchronize. * include/std/thread (thread, operator==, this_thread::get_id) (this_thread::yield): Move to new header. (operator<=>, operator!=, operator<, operator<=, operator>) (operator>=, hash<thread::id>, operator<<): Define even when gthreads not available. * src/c++11/thread.cc: Include <memory>. * include/bits/std_thread.h: New file. (thread, operator==, this_thread::get_id, this_thread::yield): Define even when gthreads not available. [!_GLIBCXX_HAS_GTHREADS] (thread::join, thread::detach) (thread::hardware_concurrency): Define inline.
next prev parent reply other threads:[~2020-11-19 13:36 UTC|newest] Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <bug-92546-4@http.gcc.gnu.org/bugzilla/> 2020-04-01 8:09 ` [Bug libstdc++/92546] [10 " rguenth at gcc dot gnu.org 2020-04-01 8:45 ` redi at gcc dot gnu.org 2020-05-07 11:56 ` [Bug libstdc++/92546] [10/11 " jakub at gcc dot gnu.org 2020-07-23 6:51 ` rguenth at gcc dot gnu.org 2020-11-05 0:02 ` redi at gcc dot gnu.org 2020-11-05 0:04 ` redi at gcc dot gnu.org 2020-11-19 13:36 ` cvs-commit at gcc dot gnu.org [this message] 2020-11-20 13:27 ` cvs-commit at gcc dot gnu.org 2020-11-20 13:49 ` cvs-commit at gcc dot gnu.org 2020-11-20 19:29 ` redi at gcc dot gnu.org 2020-12-13 22:02 ` redi at gcc dot gnu.org 2021-01-28 16:29 ` jakub at gcc dot gnu.org 2021-01-28 17:07 ` [Bug libstdc++/92546] " redi at gcc dot gnu.org 2021-04-08 8:47 ` redi at gcc dot gnu.org 2021-04-08 8:50 ` redi at gcc dot gnu.org 2021-04-08 8:51 ` redi at gcc dot gnu.org 2021-04-08 8:51 ` redi at gcc dot gnu.org 2021-04-09 17:00 ` redi at gcc dot gnu.org 2021-10-01 19:40 ` cvs-commit at gcc dot gnu.org 2021-10-08 14:00 ` cvs-commit at gcc dot gnu.org 2022-03-17 17:52 ` cvs-commit at gcc dot gnu.org 2022-03-18 10:42 ` redi at gcc dot gnu.org 2022-03-18 10:46 ` cvs-commit at gcc dot gnu.org 2022-03-18 10:57 ` redi at gcc dot gnu.org 2022-03-18 11:00 ` redi at gcc dot gnu.org 2022-03-24 22:31 ` redi at gcc dot gnu.org 2022-05-06 8:30 ` jakub at gcc dot gnu.org 2023-05-08 12:21 ` rguenth at gcc dot gnu.org 2023-05-08 12:49 ` redi at gcc dot gnu.org 2023-05-12 14:47 ` redi at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-92546-4-NGbc9aRmB4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).