From: Greg Colvin (gcolvin_at_[hidden])
Date: 2001-08-21 12:05:29


From: <williamkempf_at_[hidden]>
> > From: "William Kempf" <williamkempf_at_h...>
> >
> > > So, what you really want is not an atomic_t type, but a ref_count
> type.
> >
> > Yes, exactly. When I looked at the atomic_t documentation I was
> left with
> > the impression that this is exactly the type I need for a reference
> count.
> > (It had win32 Interlocked* semantics, AFAICS.) Apparently I
> misunderstood.
>
> The Win32 Interlocked* semantics are not enough to insure a proper
> ref-counting implementation... especially when you talk portably.
> Alexander tried to point this out with the links he posted. The fact
> that InterlockedIncrement and InterlockedDecrement are enough on IA32
> is just a (un)happy coincidence. Ref-counting is a higher level
> concept than an atomic integer.

Right. So the right for thing boost::shared_ptr to do when
boost::thread is accepted is to implement its own optional
thread-safe counter, but as detail, not a public interface.

Then at some point, if we wish, we can publish an interface
in the threads library.