[RFC] 12658_thread.cc randomly fails (on MP machines)

Paolo Carlini pcarlini@suse.de
Tue Jul 13 12:01:00 GMT 2004


Paolo Carlini wrote:

> Point 2- is much more nasty, because implies that *any* locale can be 
> in fact a ref-copy of _S_global or _S_classic! In principle, *every* 
> operation on locales (e.g., also the copy constructor, the assignment 
> operator) can be dangerous and must be protected.
> Therefore, it looks like we have to make a decision: either we add 
> locking bits in a few other places (much better if we can do that with 
> zero overhead in the non-multithreaded case), or we can stay with 
> something simpler.

Well, I think that the above is by and large incorrect: the other 
operations (besides locale::global() and locale::locale(), I mean) do 
*not* access _S_global directly and therefore seem safe. My bad, sorry.

Therefore, the problem must be somewhere else...

Now, I'm tentatively suspecting everything related to the 
locale::locale(const char*) constructor. If I change the original 
testcase as in the attached to avoid that specific constructor but 
otherwise keeping its full complexity, it doesn't fail anymore on 4-way 
machines.

Paolo.

/////////////
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 12658_thread-1_mod.cc
Type: text/x-c++src
Size: 2128 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20040713/0ea36ff2/attachment.bin>


More information about the Libstdc++ mailing list