Boost logo

Boost :

From: terekhov_at_[hidden]
Date: 2001-11-17 13:51:33

--- In boost_at_y..., "Peter Dimov" <pdimov_at_m...> wrote:
> In order to make shared_ptr thread safe (w.r.t. reference counting)
we need
> an atomic_counter type, with the following operations defined:
> atomic_counter a(n); // n is the initial value, convertible
to 'long'
> ++a; // atomic increment, returns the new value (by value,
type 'long')
> --a; // atomic decrement, returns the new value (by value,
type 'long')
> a; // convertible to long, atomic read (to support use_count() and
> See below for a proposed implementation.
> Comments are welcome.

(Java: VOLATILE-ACQUIRE memory semantics == mutex.lock memory
semantics; VOLATILE-RELEASE memory semantics == mutex.unlock
memory semantics)
("READ MEMORY BARRIER" == mutex.lock memory semantics)


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