This is the mail archive of the
mailing list for the libstdc++ project.
Re: string and __thread
- From: Martin Sebor <sebor at roguewave dot com>
- Cc: libstdc++ at gcc dot gnu dot org
- Date: Fri, 28 Mar 2003 15:43:55 -0700
- Subject: Re: string and __thread
- Organization: Rogue Wave Software, Inc.
- References: <20030328223847.GD16816@tofu.dreamhost.com>
- Reply-to: libstdc++ at gcc dot gnu dot org
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
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.