|
Boost : |
From: Peter Dimov (pdimov_at_[hidden])
Date: 2006-01-30 15:06:42
David Maisonave wrote:
> Please look at the current smart pointer locking method:
> http://code.axter.com/smart_ptr.h
> By using intrusive lock logic, you can lock the pointee, and thereby
> locking all the shared_ptr objects.
> Here's the smart pointer destructor:
> inline ~smart_ptr() throw()
> {
> m_ownership_policy.destructor_lock_policy(m_type);
> CHECKING_POLICY::before_release(m_type);
> m_ownership_policy.release(m_type, m_clone_fct,
> m_ownership_policy);
> CHECKING_POLICY::after_release(m_type);
> }
>
> There's similar logic in constructor and assignment operator.
> This should work on all three main types of reference policies, to
> include reference-link.
That's what I thought. But if you have support from the pointee, why not
just use intrusive_ptr? It should be even faster, on all operations, not
just init.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk