This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


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

Re: STL safe for use in multi-threaded programs?


Adrian Miranda wrote:

> Are there any known problems with thread-safely in the STL?  I was
> using a couple of the following:
>
>         map<string, map<string, string> >
>
> My multi-threaded program was suffering from irregular core dumps deep
> within some STL memory allocation routines (it appeared).  Once I
> surrounded all use of the map with a mutex, the core dumps when away.
> This is compiled with gcc 2.95.1, on Solaris 2.6 sparc.
>
> Is this a known problem, or should I try to track it down further?

It's a known problem - the gcc's STL string implementation is not
thread-safe. You might want to have a look at SGI's implementation -
while it's arguably is not as efficient as the gcc's one, it's certainly
thread-safe.

> Adrian

Dima


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