Re: What's the connection between objects and threads?
On May 19, 8:13 pm, gpderetta <gpdere...@gmail.com> wrote:
On May 19, 7:10 pm, Szabolcs Ferenczi <szabolcs.feren...@gmail.com>
wrote:
[...]
For instance here:
"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. "
http://www.sgi.com/tech/stl/thread_safety.html
Yes, in that sense is thread safe.
In fact, short of having transactional memory (which allows
arbitrary composition of atomic operations) it is, arguably,
the only useful sense.
I'm not too sure what you mean by transactional memory. In
general, however, containers that's the only useful sense of
thread safety for containers which "leak" references to internal
objects.
More importantly: the implementor here has *documented* the
contract which the implemention provides. And *that* is the key
meaning behind thread safety. Thread safety is first and
foremost a question of documentation.
Unfortunately (efficient) transactional memory is mostly an
academic topic.
Aha. That's why I'm not too familiar with it.
BTW, IIRC the incoming C++ standard will guarantee the same
thread safety stated in the SGI document (which is, of course,
not the standard).
That's the basic intention. I believe that there are a few
small open issues, but the basic philosophy is the same as that
in the SGI implementation.
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34