|
Boost : |
From: Scott McCaskill (scott_at_[hidden])
Date: 2001-08-21 14:54:53
> 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.
>
Agreed. I have a need for this, so I'm looking forward to it. For now I
have copied and modified shared_ptr so I have a shared_ptr with a thread
safe reference count.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk