This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/12658] Thread safety problems in locale::global() and locale::locale()
- From: "pcarlini at unitus dot it" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 13 Dec 2003 08:55:31 -0000
- Subject: [Bug libstdc++/12658] Thread safety problems in locale::global() and locale::locale()
- References: <20031017095219.12658.peturr02@ru.is>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From pcarlini at unitus dot it 2003-12-13 08:55 -------
Subject: Re: Thread safety problems in locale::global()
and locale::locale()
bkoz at gcc dot gnu dot org wrote:
>------- Additional Comments From bkoz at gcc dot gnu dot org 2003-12-13 06:35 -------
>
>Well......... something like this will work. It's modeled off of the glibc
>setlocale bits, and I think it will work.
>
>Thoughts?
>
>
Probably, for locale::global() a lock is really needed, I agree with you.
However, for this
> locale::locale() throw()
> {
> _S_initialize();
>! (_M_impl = _S_global)->_M_add_reference();
> }
>
>
Are you really sure that the trivial rearrangement that I proposed
doesn't suffice?
It appears to answer Pétur's analysis...
Paolo.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12658