[Bug libstdc++/21334] Lack of Posix compliant thread safety in std::basic_string
james dot kanze at gmail dot com
gcc-bugzilla@gcc.gnu.org
Tue May 8 15:11:00 GMT 2007
------- Comment #37 from james dot kanze at gmail dot com 2007-05-08 16:11 -------
Subject: Re: Lack of Posix compliant thread safety in std::basic_string
On 7 May 2007 21:08:05 -0000, gianni at mariani dot ws
<gcc-bugzilla@gcc.gnu.org> wrote:
> ------- Comment #35 from gianni at mariani dot ws 2007-05-07 22:08 -------
> Is this really a bug ? Any discussion in the upcoming standardization of
> threads that talks about calling a non-const begin() on a std::string ?
> If we take James's code and replace the "g" definition like so:
> std::string g_modifyable ;
> const std::string & g = g_modifyable;
> ... there is no race condition.
> Who said that calling begin() on a non const std::string
> should be thread safe ?
Posix and common sense. Just as using a char* (rather than a
char const*) to access a char[] is thread safe.
But let's not start that again. The ISO committee is discussing
the issue, and will doubtlessly decide one way or another.
(Before they get that far, they have to agree on what a thread
means:-).) In the meantime, all of the other implementations
work (but have other disadvantages); the g++ implementation
doesn't.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21334
More information about the Gcc-bugs
mailing list