forked from boostorg/smart_ptr
Merge branch 'develop'
This commit is contained in:
@ -17,7 +17,7 @@
|
|||||||
// http://www.boost.org/LICENSE_1_0.txt)
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
//
|
//
|
||||||
|
|
||||||
#include <boost/detail/interlocked.hpp>
|
#include <boost/smart_ptr/detail/sp_interlocked.hpp>
|
||||||
|
|
||||||
namespace boost
|
namespace boost
|
||||||
{
|
{
|
||||||
@ -35,12 +35,12 @@ public:
|
|||||||
|
|
||||||
long operator++()
|
long operator++()
|
||||||
{
|
{
|
||||||
return BOOST_INTERLOCKED_INCREMENT( &value_ );
|
return BOOST_SP_INTERLOCKED_INCREMENT( &value_ );
|
||||||
}
|
}
|
||||||
|
|
||||||
long operator--()
|
long operator--()
|
||||||
{
|
{
|
||||||
return BOOST_INTERLOCKED_DECREMENT( &value_ );
|
return BOOST_SP_INTERLOCKED_DECREMENT( &value_ );
|
||||||
}
|
}
|
||||||
|
|
||||||
operator long() const
|
operator long() const
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
// formulation
|
// formulation
|
||||||
//
|
//
|
||||||
|
|
||||||
#include <boost/detail/interlocked.hpp>
|
#include <boost/smart_ptr/detail/sp_interlocked.hpp>
|
||||||
#include <boost/detail/workaround.hpp>
|
#include <boost/detail/workaround.hpp>
|
||||||
#include <boost/detail/sp_typeinfo.hpp>
|
#include <boost/detail/sp_typeinfo.hpp>
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ public:
|
|||||||
|
|
||||||
void add_ref_copy()
|
void add_ref_copy()
|
||||||
{
|
{
|
||||||
BOOST_INTERLOCKED_INCREMENT( &use_count_ );
|
BOOST_SP_INTERLOCKED_INCREMENT( &use_count_ );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool add_ref_lock() // true on success
|
bool add_ref_lock() // true on success
|
||||||
@ -86,11 +86,11 @@ public:
|
|||||||
// work around a code generation bug
|
// work around a code generation bug
|
||||||
|
|
||||||
long tmp2 = tmp + 1;
|
long tmp2 = tmp + 1;
|
||||||
if( BOOST_INTERLOCKED_COMPARE_EXCHANGE( &use_count_, tmp2, tmp ) == tmp2 - 1 ) return true;
|
if( BOOST_SP_INTERLOCKED_COMPARE_EXCHANGE( &use_count_, tmp2, tmp ) == tmp2 - 1 ) return true;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
if( BOOST_INTERLOCKED_COMPARE_EXCHANGE( &use_count_, tmp + 1, tmp ) == tmp ) return true;
|
if( BOOST_SP_INTERLOCKED_COMPARE_EXCHANGE( &use_count_, tmp + 1, tmp ) == tmp ) return true;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -98,7 +98,7 @@ public:
|
|||||||
|
|
||||||
void release() // nothrow
|
void release() // nothrow
|
||||||
{
|
{
|
||||||
if( BOOST_INTERLOCKED_DECREMENT( &use_count_ ) == 0 )
|
if( BOOST_SP_INTERLOCKED_DECREMENT( &use_count_ ) == 0 )
|
||||||
{
|
{
|
||||||
dispose();
|
dispose();
|
||||||
weak_release();
|
weak_release();
|
||||||
@ -107,12 +107,12 @@ public:
|
|||||||
|
|
||||||
void weak_add_ref() // nothrow
|
void weak_add_ref() // nothrow
|
||||||
{
|
{
|
||||||
BOOST_INTERLOCKED_INCREMENT( &weak_count_ );
|
BOOST_SP_INTERLOCKED_INCREMENT( &weak_count_ );
|
||||||
}
|
}
|
||||||
|
|
||||||
void weak_release() // nothrow
|
void weak_release() // nothrow
|
||||||
{
|
{
|
||||||
if( BOOST_INTERLOCKED_DECREMENT( &weak_count_ ) == 0 )
|
if( BOOST_SP_INTERLOCKED_DECREMENT( &weak_count_ ) == 0 )
|
||||||
{
|
{
|
||||||
destroy();
|
destroy();
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
// http://www.boost.org/LICENSE_1_0.txt)
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
//
|
//
|
||||||
|
|
||||||
#include <boost/detail/interlocked.hpp>
|
#include <boost/smart_ptr/detail/sp_interlocked.hpp>
|
||||||
#include <boost/smart_ptr/detail/yield_k.hpp>
|
#include <boost/smart_ptr/detail/yield_k.hpp>
|
||||||
|
|
||||||
// BOOST_COMPILER_FENCE
|
// BOOST_COMPILER_FENCE
|
||||||
@ -59,7 +59,7 @@ public:
|
|||||||
|
|
||||||
bool try_lock()
|
bool try_lock()
|
||||||
{
|
{
|
||||||
long r = BOOST_INTERLOCKED_EXCHANGE( &v_, 1 );
|
long r = BOOST_SP_INTERLOCKED_EXCHANGE( &v_, 1 );
|
||||||
|
|
||||||
BOOST_COMPILER_FENCE
|
BOOST_COMPILER_FENCE
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user