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: [Semi-OT] The C++ Standard Library



> On Feb 18, 1999, Paul Derbyshire <pderbysh@usa.net> wrote:
> 
> > Q: Are STL containers guaranteed to be thread safe?

At the risk of sounding like Bill Clinton or Bill Gates: it depends
on what your definition of "thread safe" is.

> No.  You must lock them externally.  However, it seems to me that the
> SGI STL, distributed with egcs, provides some threading support, but
> you'd have to check.

You can read the details about what operations are thread-safe, and
which are not, with SGI STL on

http://www.sgi.com/Technology/STL/thread_safety.html

The relevant paragraph is

> The SGI implementation of STL is thread-safe only in the sense that
> simultaneous accesses to distinct containers are safe, and simultaneous
> read accesses to to shared containers are safe. If multiple threads access
> a single container, and at least one thread may potentially write, then
> the user is responsible for ensuring mutual exclusion between the threads
> during the container accesses.


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