[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: libstc++2.10-dev & threads

On Tue, 11 Jul 2000, Chris Leishman wrote:
>> > I've just started doing a little coding in c++ using threads - and I've
>> > quickly come to realise that the version of the STL in libstdc++2.10-dev
>> > is _not_ thread safe.
>> Can you be a bit more specific? I'm doing some multi-threaded STL
>> stuff myself and would be very interested in seeing what you problems
>> are.
>Sure.... try writing any code that uses class string (actually basic_string).
>I found that even using string objects created on the stack (thus thread
>specific) was still a problem, and I was getting SEGV deep down in the string
>allocator (where two threads where simultaneously calling free()).

It sounds like you are trying to free a string in two threads at the same
time.  It seems that the STL is designed around letting you do the
thread-safe part yourself so there's no locking being done when it's not
necessary.  My multi-threaded STL programs work quite well.

My current location - X marks the spot.

Reply to: