Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2006-10-19 12:58:14


Hey Chris,

Chris Thomasson wrote:
> Currently, Boost doesn't provide support for atomic reference
> counting; shared_ptr<T> falls under 'basic' thread-safety. I propose
> a reference counting algorithm that falls under 'strong'
> thread-safety. Here is a experimental prototype I created:
>
> http://appcore.home.comcast.net/vzoom/refcount/

This doesn't contain any documentation, only source. You can't expect people
to understand it without at least a brief reference that specifies what the
various functions are supposed to do.

> A SPARC 32-64 version is underway. Here is some more information on my
> algorithm:
>
> http://groups.google.com/group/comp.programming.threads/browse_frm/thread/4e8717d3bcdedfe9
> (initial idea; pseudo-code)

Imagine that I add two member functions to shared_ptr:

shared_ptr<T> shared_ptr<T>::copy() const; // return *this
void shared_ptr<T>::replace( shared_ptr<T> const & p ); // *this = p

that are synchronized with a mutex/spinlock/rwlock/rwspinlock and I declare
that "strong" thread safety is offered only when everything goes through
these two accessors and nothing else.

Is this inferior to your proposed scheme? In what scenarios? Can you
implement the copy/replace interface in a "more lock-free way" using your
scheme (you are allowed to add to sp_counted_base whatever members you
need)?


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