This is the mail archive of the
libstdc++@sourceware.cygnus.com
mailing list for the libstdc++ project.
Re: Thread safety and string
- To: Jonathan H Lundquist <jhl AT sssonline dot com>
- Subject: Re: Thread safety and string
- From: Benjamin Kosnik <bkoz AT cygnus dot com>
- Date: Mon, 13 Sep 1999 14:01:56 -0700 (PDT)
- cc: "'libstdc++ AT sourceware.cygnus dot com'" <libstdc++ AT sourceware.cygnus dot com>
> "While parts of the SGI STL are used in libstdc++-v3, their string class
> is not. The SGI string is essentially vector<char> and does not do any
> reference counting like libstdc++-v3's does. (It is O(n), though.)
> Contrary to what some say, reference counting is not incompatable with
> multithreading, if done correctly"
Hmm. This is not as clear as it should be. I'm defining a thread-safe
container as per the SGI STL definition, here:
http://www.sgi.com/Technology/STL/thread_safety.html
v-3's string implementation uses ref-counted strings, and is thought to be
thread-safe. I would be interested in your experiences using it in such a
matter. Nathan Myers, its principal author, may be able to offer more info
and field more specific questions.
SGI STL 3.2 has another string implementation, which is also believed to
be thread-safe. There is also the SGI STL rope container.
So you have a lot of choices, all of which should be thread-safe.
-Benjamin