forked from boostorg/smart_ptr
Fix VC6 codegen issue (Alain Cormier)
[SVN r33747]
This commit is contained in:
@ -25,6 +25,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#include <boost/detail/interlocked.hpp>
|
#include <boost/detail/interlocked.hpp>
|
||||||
|
#include <boost/detail/workaround.hpp>
|
||||||
#include <typeinfo>
|
#include <typeinfo>
|
||||||
|
|
||||||
namespace boost
|
namespace boost
|
||||||
@ -78,7 +79,19 @@ public:
|
|||||||
{
|
{
|
||||||
long tmp = static_cast< long const volatile& >( use_count_ );
|
long tmp = static_cast< long const volatile& >( use_count_ );
|
||||||
if( tmp == 0 ) return false;
|
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;
|
if( BOOST_INTERLOCKED_COMPARE_EXCHANGE( &use_count_, tmp + 1, tmp ) == tmp ) return true;
|
||||||
|
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user