Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2008-01-18 13:34:11


Jeffrey Yasskin:

> Porting lock-free data structures from Java is complicated by the fact
> that the implementations assume garbage collection. There are a few
> techniques available for dealing with manual memory management without
> locks, but they complicate the implementation of algorithms that are
> complex enough already. So I'm thinking about trying to implement an
> atomic_shared_ptr<T> along the lines of the interface for other
> atomics defined in
> http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2427.html but
> using shared_ptr<T> as a value type. The implementation I'm thinking
> of uses hazard pointers
> (http://erdani.org/publications/cuj-2004-12.pdf) and double-wide-cas
> (cmpxchg16b on x86-64). So I have three questions for this list:
>
> 1) Would there be interest in adding such a type to the Boost smart
> pointers?

I (and many others) will be very, very interested in your implementation,
doubly so if you implement it using the interface proposed in

http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2007/n2297.html#atomic

I can't guarantee that your implementation will make it into Boost since
hazard pointers are rumored to be patent-encumbered.

> 2) Has someone already done this?

If you google :-) for Joe Seigh's atomic_ptr, you'll find his
implementation. It doesn't implement the entire shared_ptr interface though,
so your implementation will be unique in this regard.


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