Boost logo

Boost :

From: Alexander Terekhov (terekhov_at_[hidden])
Date: 2002-10-21 04:57:47

Joe Gottman wrote:
> David Abrahams wrote:
> [...]
> > * "Thread-safe": this is a term which is well-defined for programs. It
> > is /not/ well-defined for classes or functions, though the
> > documentation uses it that way repeatedly. ....
> The SGI STL implementation gives a good definition of the minimal acceptable
> level of thread safety in a class that may be used in multi-threaded
> programs (see ). To

Well, the POSIX version is here [missing pthread_once() and *erroneously*
mentioned pthread_cond_signal()/ _broadcast() aside]:
(General Concepts, Memory Synchronization)

> paraphrase, it says that simultaneous accesses to distinct objects are
> safe, and simultaneous read accesses to shared objects are safe. If a class
> obeys these two rules, then it should be possible to make a shared object of
> that class thread safe by putting a mutex, critical section, etc. arround
> any write accesses to that object.

Unfortunately, this is NOT true because on one hand, POSIX doesn't address
the problem of word-tearing with respect to "adjacent" objects in neither
C nor C++, and, on the other hand, neither C nor C++ acknowledge the
existence of threads/shared memory access with respect to threads/processes.
You might want to take a look at this thread:
(comp.std.c, Subject: "memory location")


Boost list run by bdawes at, gregod at, cpdaniel at, john at