libstdc++/5037: Multithreaded read access to strings not threadsafe on Solaris/Sparc

Stuart Brown sbrown@inforonics.com
Mon Jun 24 04:30:00 GMT 2002


I am wondering what are the reason(s) for using a spin lock instead of a
cas instruction on to make the string ref count thread safe on Sparc v9.
Won't there be contention for this lock ? Sun's technical paper suggests
that cas is better when the number of threads is greater than the number
of cpus, which is not uncommon in MT programs.  Also, doesn't this
restrict the usability of the atomicity methods since use in other classes
could make contention worse ?

here is the sun article 

http://soldc.sun.com/articles/stl-new.html

Stuart Brown
sbrown@inforonics.com





More information about the Libstdc++ mailing list