Boost logo

Boost :

From: Jesse Jones (jesjones_at_[hidden])
Date: 2001-11-17 19:26:30


At 5:18 PM +0200 11/17/01, Peter Dimov 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 unique())

The copy semantics need to be ironed out. In the code that was posted
the Windows version can be copied with no problems. The pthreads
version can also be copied, but I think bad things will happen
because the mutex is bit-wise copied. Simply disabling copying may be
OK.

   -- Jesse


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