thread-safe strings
Nathan Myers
ncm@cantrip.org
Sat Apr 1 00:00:00 GMT 2000
On Wed, Mar 15, 2000 at 09:10:15AM +0100, Martin v. Loewis wrote:
> > I've looked over the code for basic_string a bit and see that there
> > is a problem with _M_state being accessed from multiple threads. Are
> > there other problems that I'm missing here? If not couldn't we just
> > put a mutex on _M_state?
>
> I think there is a number of problems with it. First, you don't know
> readily what thread system you are using, and whether it has a mutex
> operation - libstdc++ should also support systems using something else
> than pthreads, as well as systems without threads.
Fortunately it's a lot less bad than Martin suggests.
There is no need for a mutex, thus no need for a thread library.
In other mail I posted a diff to use appropriate primitives
which must be declared appropriately for the target platform,
as noted there.
Nathan Myers
ncm@cantrip.org
More information about the Libstdc++
mailing list