This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [Semi-OT] The C++ Standard Library
- To: oliva at dcc dot unicamp dot br (Alexandre Oliva)
- Subject: Re: [Semi-OT] The C++ Standard Library
- From: Joe Buck <jbuck at Synopsys dot COM>
- Date: Thu, 18 Feb 99 10:10:25 PST
- Cc: pderbysh at usa dot net, djgpp at delorie dot com, egcs at egcs dot cygnus dot com
> 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.