|
Boost Users : |
From: Peter Dimov (pdimov_at_[hidden])
Date: 2006-04-19 17:08:32
Alain Cormier wrote:
> So, can I conclude that it is a bad behavior in boost::weak_ptr? 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. Can I expect
> this workaround (or any better) in boost in a near future so that
> weak_ptr truly work with VC6 in release and multi-threaded
> environment?
I have applied your fix. It will be included in the upcoming release 1.34.
Thanks for the report!
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