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]
Other format: [Raw text]

Re: string and __thread


Nathan Myers wrote:
As I understand it, much (most?) of the contention observed for basic_string<> in heavily-threaded real-world programs occurs in fights over access to the reference count on the (single) static empty-string _Rep object.

It occurs to me that we might declare that object "__thread",

Wouldn't this prevent the empty string(s) from being interoperable between threads? Assuming your string code compares the address of the empty reference to decide what it's dealing with (just like ours does), the address is going to be different in each thread and what's recognized as the empty string in the thread that created it is going to be taken to be an ordinary (non-empty) string object is another.

Regards
Martin


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