Boost logo

Boost :

From: Ed Brey (brey_at_[hidden])
Date: 2000-06-05 08:33:53


From: "John Maddock" <John_Maddock_at_[hidden]>

> Level 1:
> (Appartment)
> Unrelated instances of the object can be safely used in separate
threads
> (by unrelated I mean "not a copy of"). Objects that meat this
guarantee
> have no unprotected non-constant shared global data, but may be
mutable.

Assuming your definition of "unrelated" as "not a copy of" applies to
all levels, then all levels treat all copies of an object as
essentially the same object, even though for many level 1 and higher
classes, copies can safely be accessed in parallel. Perhaps another
ortagonal adornment is needed to indicate whether copies should be
considered unrelated.

> Level 2:
> (weak guarantee)
> Unrelated instances of an object can be used in separate threads.
> An object may be shared between thread without external locking if
all the
> threads that operate on the object treat it as constant (access no
mutable
> data, call no non-constant member functions).

Is the restriction agains accessing mutable data in any way required?
Restricting only against writing mutable data seems more practical.

> An shared object treated as non-constant by any one thread, must be
> protected by an external lock for all accesses to that object (const
and
> non-constant) by all threads.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk