Mail Archives: djgpp/1999/02/18/13:12:19
> On Feb 18, 1999, Paul Derbyshire <pderbysh AT usa DOT 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.
- Raw text -