This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
std:string thread-safety
- To: libstdc++ at gcc dot gnu dot org
- Subject: std:string thread-safety
- From: Boris Goldberg <boris dot goldberg at msdw dot com>
- Date: Thu, 22 Mar 2001 17:34:24 -0500
- Organization: Morgan Stanley & Co.
Hi all,
I have a question:
here is what I see in bastring.h which comes with g++/gcc 2.95.2.1:
#elif defined __sparcv9__
void release ()
{
size_t __newval, __oldval = ref;
do
{
__newval = __oldval - 1;
__asm__ ("cas [%4], %2, %0"
: "=r" (__oldval), "=m" (ref)
: "r" (__oldval), "m" (ref), "r"(&(ref)), "0" (__newval));
}
while (__newval != __oldval);
if (__oldval == 0)
delete this;
}
As I understand, this assembly code makes std::string thread-safe.
The problem is, __sparcv9__ is not defined on our UltraSparc systems
and the string ends up being thread-unsafe and it crashes.
Can you shed some light on this?
Thanks,
Boris Goldberg