|
Boost Users : |
From: Peter Dimov (pdimov_at_[hidden])
Date: 2006-04-19 11:44:51
Alain Cormier wrote:
> So, can I conclude that it is a bad behavior in boost::weak_ptr?
No, it is a bug in VC6.
> For now, I have simply changed add_ref_lock to :
>
> long tmp2 = tmp + 1;
> if(InterlockedCompareExchange ( &use_count_, tmp2, tmp ) == tmp2 - 1 )
> return true;
>
> This way, VC6 doesn't optimise the return value of
> InterlockedCompareExchange and the disassembly looks ok.
I don't think that there is any guarantee that this modification will
reliably produce correct code, even if it happens to work in the examples we
try. But if we can't think of a better way to work around the issue, this
may be our best bet.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net