|
Boost : |
From: Peter Dimov (pdimov_at_[hidden])
Date: 2006-11-10 12:32:42
Peter Dimov wrote:
> bool compare_and_swap( shared_ptr & p, shared_ptr const & cmp,
> shared_ptr xchg )
>
> lock spinlock for p
> bool r = p == cmp;
> if( r ) p.swap( xchg );
> unlock spinlock for p
> return r;
This actually should be
trylock spinlock for p
if failed return false
bool r = p == cmp;
if( r ) p.swap( xchg );
unlock spinlock for p
return r;
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk