
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:
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/4e... (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)?