Fix VC6 codegen issue (Alain Cormier)

[SVN r33747]
This commit is contained in:
Peter Dimov
2006-04-19 21:03:18 +00:00
parent 747c9a1d3e
commit 203764eb51

View File

@ -25,6 +25,7 @@
//
#include <boost/detail/interlocked.hpp>
#include <boost/detail/workaround.hpp>
#include <typeinfo>
namespace boost
@ -78,7 +79,19 @@ public:
{
long tmp = static_cast< long const volatile& >( use_count_ );
if( tmp == 0 ) return false;
#if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, == 1200 )
// work around a code generation bug
long tmp2 = tmp + 1;
if( BOOST_INTERLOCKED_COMPARE_EXCHANGE( &use_count_, tmp2, tmp ) == tmp2 - 1 ) return true;
#else
if( BOOST_INTERLOCKED_COMPARE_EXCHANGE( &use_count_, tmp + 1, tmp ) == tmp ) return true;
#endif
}
}