This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/20099] -pthreads should imply -fno-threadsafe-statics
- From: "qrczak at knm dot org dot pl" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 20 Feb 2005 10:16:37 -0000
- Subject: [Bug c++/20099] -pthreads should imply -fno-threadsafe-statics
- References: <20050220004607.20099.davids@webmaster.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From qrczak at knm dot org dot pl 2005-02-20 10:16 -------
> You cannot create code that works with this option and doesn't work without it
> except by violating the POSIX standard. So POSIX code should not have this
> option enabled by default -- it's a pure pessimization.
POSIX doesn't say anything about C++, and C++ doesn't say anything about threads
- we are already outside the scopes of these standards.
A reasonable extension of C++ to multithreading should give static locals the
semantics analogous to pthread_once. This allows to write code which uses lazy
initialization, is MT-safe, yet doesn't use a threading library explicitly - is
portable to C++ without threads. Note that this doesn't break any correct
program which doesn't make use of this.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20099