This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

std:string thread-safety




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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]