Boost logo

Boost :

From: Dave Abrahams (abrahams_at_[hidden])
Date: 1999-12-28 20:50:30


> The examples of the SGI STL show a container is simply not thread-safe
> (in the sense that a write to the container is not atomic). The
> documentation talks about how the user can create their own wrapper
> (e.g. locked_queue) if atomic operations are desired.

The analogy is not a good one. The atomicity of storing pointers (yes,
platform-dependent) is often the exact mechanism used to accomplish
thread-safety. The corresponding use of shared_ptr might make a lot of
sense. If you don't build the support directly into shared_ptr, then adding
it in an external wrapper will incur an undesirable cost at runtime,
especially on those platforms with support for the atomic decrement-and-test
operations.

-Dave


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