migrate some of the biggest consumer of osl_*InterlockedCount to osl_atomic

Change-Id: I0e6992afbeffaf3b993e6630fb396d93012890e0
Reviewed-on: https://gerrit.libreoffice.org/632
Tested-by: Norbert Thiebaud <nthiebaud@gmail.com>
Reviewed-by: Norbert Thiebaud <nthiebaud@gmail.com>
This commit is contained in:
Norbert Thiebaud 2012-09-16 02:00:14 -05:00
parent c9d3373dad
commit 195f17ee40
24 changed files with 98 additions and 109 deletions

View File

@ -108,11 +108,11 @@ namespace css = com::sun::star;
}
oslInterlockedCount Access::acquireCounting() {
return osl_incrementInterlockedCount(&m_refCount);
return osl_atomic_increment(&m_refCount);
}
void Access::releaseNondeleting() {
osl_decrementInterlockedCount(&m_refCount);
osl_atomic_decrement(&m_refCount);
}
bool Access::isValue() {

View File

@ -56,7 +56,7 @@ inline Sequence< E >::Sequence() SAL_THROW(())
template< class E >
inline Sequence< E >::Sequence( const Sequence< E > & rSeq ) SAL_THROW(())
{
::osl_incrementInterlockedCount( &rSeq._pSequence->nRefCount );
osl_atomic_increment( &rSeq._pSequence->nRefCount );
_pSequence = rSeq._pSequence;
}

View File

@ -66,13 +66,13 @@ public:
Base(): m_count(0) {}
void acquire() {
if (osl_incrementInterlockedCount(&m_count) == SAL_MAX_INT32) {
if (osl_atomic_increment(&m_count) == SAL_MAX_INT32) {
abort();
}
}
void release() {
if (osl_decrementInterlockedCount(&m_count) == 0) {
if (osl_atomic_decrement(&m_count) == 0) {
delete this;
}
}

View File

@ -67,12 +67,12 @@ public:
virtual void SAL_CALL acquire() throw ()
{
osl_incrementInterlockedCount( &m_refCount );
osl_atomic_increment( &m_refCount );
}
virtual void SAL_CALL release() throw ()
{
if ( 0 == osl_decrementInterlockedCount( &m_refCount ) )
if ( 0 == osl_atomic_decrement( &m_refCount ) )
delete this;
}

View File

@ -284,12 +284,12 @@ void Base::acquire(void)
{
m_env_acquire(m_pEnv);
osl_incrementInterlockedCount(&m_nRef);
osl_atomic_increment(&m_nRef);
}
void Base::release(void)
{
if (osl_decrementInterlockedCount(&m_nRef) == 0)
if (osl_atomic_decrement(&m_nRef) == 0)
delete this;
else
@ -299,7 +299,7 @@ void Base::release(void)
void Base::harden(uno_Environment ** ppHardEnv)
{
m_env_harden(ppHardEnv, m_pEnv);
osl_incrementInterlockedCount(&m_nRef);
osl_atomic_increment(&m_nRef);
}
void Base::acquireWeak(void)

View File

@ -191,7 +191,7 @@ void Mapping::mapInterface(
void Mapping::acquire() SAL_THROW(())
{
if (osl_incrementInterlockedCount(&m_nCount) == 1)
if (osl_atomic_increment(&m_nCount) == 1)
{
uno_Mapping * pMapping = this;
@ -201,7 +201,7 @@ void Mapping::acquire() SAL_THROW(())
void Mapping::release() SAL_THROW(())
{
if (osl_decrementInterlockedCount(&m_nCount) == 0)
if (osl_atomic_decrement(&m_nCount) == 0)
::uno_revokeMapping(this);
}

View File

@ -307,7 +307,7 @@ void Proxy::acquire(void)
NULL,
NULL);
if (osl_incrementInterlockedCount(&m_nRef) == 1)
if (osl_atomic_increment(&m_nRef) == 1)
{
// rebirth of proxy zombie
void * pThis = this;
@ -350,7 +350,7 @@ void Proxy::release(void)
NULL,
NULL);
if (osl_decrementInterlockedCount(&m_nRef) == 0)
if (osl_atomic_decrement(&m_nRef) == 0)
m_from.get()->pExtEnv->revokeInterface(m_from.get()->pExtEnv, this);
if (probeFun)

View File

@ -601,8 +601,7 @@ extern "C" void SAL_CALL typelib_typedescription_newEmpty(
typelib_IndirectTypeDescription * pIndirect = (typelib_IndirectTypeDescription *)pTmp;
pRet = (typelib_TypeDescription *)pTmp;
#if OSL_DEBUG_LEVEL > 1
osl_incrementInterlockedCount(
&Init::get().nArrayTypeDescriptionCount );
osl_atomic_increment( &Init::get().nArrayTypeDescriptionCount );
#endif
pIndirect->pType = 0;
pTmp->nDimensions = 0;
@ -616,8 +615,7 @@ extern "C" void SAL_CALL typelib_typedescription_newEmpty(
typelib_IndirectTypeDescription * pTmp = new typelib_IndirectTypeDescription();
pRet = (typelib_TypeDescription *)pTmp;
#if OSL_DEBUG_LEVEL > 1
osl_incrementInterlockedCount(
&Init::get().nIndirectTypeDescriptionCount );
osl_atomic_increment( &Init::get().nIndirectTypeDescriptionCount );
#endif
pTmp->pType = 0;
}
@ -629,8 +627,7 @@ extern "C" void SAL_CALL typelib_typedescription_newEmpty(
pTmp = new typelib_UnionTypeDescription();
pRet = (typelib_TypeDescription *)pTmp;
#if OSL_DEBUG_LEVEL > 1
osl_incrementInterlockedCount(
&Init::get().nUnionTypeDescriptionCount );
osl_atomic_increment( &Init::get().nUnionTypeDescriptionCount );
#endif
pTmp->nMembers = 0;
pTmp->pDiscriminantTypeRef = 0;
@ -648,8 +645,7 @@ extern "C" void SAL_CALL typelib_typedescription_newEmpty(
pTmp = new typelib_StructTypeDescription();
pRet = (typelib_TypeDescription *)pTmp;
#if OSL_DEBUG_LEVEL > 1
osl_incrementInterlockedCount(
&Init::get().nCompoundTypeDescriptionCount );
osl_atomic_increment( &Init::get().nCompoundTypeDescriptionCount );
#endif
pTmp->aBase.pBaseTypeDescription = 0;
pTmp->aBase.nMembers = 0;
@ -667,8 +663,7 @@ extern "C" void SAL_CALL typelib_typedescription_newEmpty(
pTmp = new typelib_CompoundTypeDescription();
pRet = (typelib_TypeDescription *)pTmp;
#if OSL_DEBUG_LEVEL > 1
osl_incrementInterlockedCount(
&Init::get().nCompoundTypeDescriptionCount );
osl_atomic_increment( &Init::get().nCompoundTypeDescriptionCount );
#endif
pTmp->pBaseTypeDescription = 0;
pTmp->nMembers = 0;
@ -683,8 +678,7 @@ extern "C" void SAL_CALL typelib_typedescription_newEmpty(
typelib_EnumTypeDescription * pTmp = new typelib_EnumTypeDescription();
pRet = (typelib_TypeDescription *)pTmp;
#if OSL_DEBUG_LEVEL > 1
osl_incrementInterlockedCount(
&Init::get().nEnumTypeDescriptionCount );
osl_atomic_increment( &Init::get().nEnumTypeDescriptionCount );
#endif
pTmp->nDefaultEnumValue = 0;
pTmp->nEnumValues = 0;
@ -698,8 +692,7 @@ extern "C" void SAL_CALL typelib_typedescription_newEmpty(
typelib_InterfaceTypeDescription * pTmp = new typelib_InterfaceTypeDescription();
pRet = (typelib_TypeDescription *)pTmp;
#if OSL_DEBUG_LEVEL > 1
osl_incrementInterlockedCount(
&Init::get().nInterfaceTypeDescriptionCount );
osl_atomic_increment( &Init::get().nInterfaceTypeDescriptionCount );
#endif
pTmp->pBaseTypeDescription = 0;
pTmp->nMembers = 0;
@ -719,8 +712,7 @@ extern "C" void SAL_CALL typelib_typedescription_newEmpty(
typelib_InterfaceMethodTypeDescription * pTmp = new typelib_InterfaceMethodTypeDescription();
pRet = (typelib_TypeDescription *)pTmp;
#if OSL_DEBUG_LEVEL > 1
osl_incrementInterlockedCount(
&Init::get().nInterfaceMethodTypeDescriptionCount );
osl_atomic_increment( &Init::get().nInterfaceMethodTypeDescriptionCount );
#endif
pTmp->aBase.pMemberName = 0;
pTmp->pReturnTypeRef = 0;
@ -739,8 +731,7 @@ extern "C" void SAL_CALL typelib_typedescription_newEmpty(
typelib_InterfaceAttributeTypeDescription * pTmp = new typelib_InterfaceAttributeTypeDescription();
pRet = (typelib_TypeDescription *)pTmp;
#if OSL_DEBUG_LEVEL > 1
osl_incrementInterlockedCount(
&Init::get().nInterfaceAttributeTypeDescriptionCount );
osl_atomic_increment( &Init::get().nInterfaceAttributeTypeDescriptionCount );
#endif
pTmp->aBase.pMemberName = 0;
pTmp->pAttributeTypeRef = 0;
@ -758,7 +749,7 @@ extern "C" void SAL_CALL typelib_typedescription_newEmpty(
{
pRet = new typelib_TypeDescription();
#if OSL_DEBUG_LEVEL > 1
osl_incrementInterlockedCount( &Init::get().nTypeDescriptionCount );
osl_atomic_increment( &Init::get().nTypeDescriptionCount );
#endif
}
}
@ -1429,7 +1420,7 @@ extern "C" CPPU_DLLPUBLIC void SAL_CALL typelib_typedescription_acquire(
typelib_TypeDescription * pTypeDescription )
SAL_THROW_EXTERN_C()
{
::osl_incrementInterlockedCount( &pTypeDescription->nRefCount );
osl_atomic_increment( &pTypeDescription->nRefCount );
}
//------------------------------------------------------------------------
@ -1586,7 +1577,7 @@ extern "C" CPPU_DLLPUBLIC void SAL_CALL typelib_typedescription_release(
typelib_TypeDescription * pTD )
SAL_THROW_EXTERN_C()
{
sal_Int32 ref = ::osl_decrementInterlockedCount( &pTD->nRefCount );
sal_Int32 ref = osl_atomic_decrement( &pTD->nRefCount );
OSL_ASSERT(ref >= 0);
if (0 == ref)
{
@ -1625,32 +1616,32 @@ extern "C" CPPU_DLLPUBLIC void SAL_CALL typelib_typedescription_release(
switch( pTD->eTypeClass )
{
case typelib_TypeClass_ARRAY:
osl_decrementInterlockedCount( &rInit.nArrayTypeDescriptionCount );
osl_atomic_decrement( &rInit.nArrayTypeDescriptionCount );
break;
case typelib_TypeClass_SEQUENCE:
osl_decrementInterlockedCount( &rInit.nIndirectTypeDescriptionCount );
osl_atomic_decrement( &rInit.nIndirectTypeDescriptionCount );
break;
case typelib_TypeClass_UNION:
osl_decrementInterlockedCount( &rInit.nUnionTypeDescriptionCount );
osl_atomic_decrement( &rInit.nUnionTypeDescriptionCount );
break;
case typelib_TypeClass_STRUCT:
case typelib_TypeClass_EXCEPTION:
osl_decrementInterlockedCount( &rInit.nCompoundTypeDescriptionCount );
osl_atomic_decrement( &rInit.nCompoundTypeDescriptionCount );
break;
case typelib_TypeClass_INTERFACE:
osl_decrementInterlockedCount( &rInit.nInterfaceTypeDescriptionCount );
osl_atomic_decrement( &rInit.nInterfaceTypeDescriptionCount );
break;
case typelib_TypeClass_INTERFACE_METHOD:
osl_decrementInterlockedCount( &rInit.nInterfaceMethodTypeDescriptionCount );
osl_atomic_decrement( &rInit.nInterfaceMethodTypeDescriptionCount );
break;
case typelib_TypeClass_INTERFACE_ATTRIBUTE:
osl_decrementInterlockedCount( &rInit.nInterfaceAttributeTypeDescriptionCount );
osl_atomic_decrement( &rInit.nInterfaceAttributeTypeDescriptionCount );
break;
case typelib_TypeClass_ENUM:
osl_decrementInterlockedCount( &rInit.nEnumTypeDescriptionCount );
osl_atomic_decrement( &rInit.nEnumTypeDescriptionCount );
break;
default:
osl_decrementInterlockedCount( &rInit.nTypeDescriptionCount );
osl_atomic_decrement( &rInit.nTypeDescriptionCount );
}
#endif
@ -1681,7 +1672,7 @@ extern "C" CPPU_DLLPUBLIC void SAL_CALL typelib_typedescription_register(
// pRef->pType->pWeakRef == 0 means that the description is empty
if (pTDR->pType->pWeakRef)
{
if (osl_incrementInterlockedCount( &pTDR->pType->nRefCount ) > 1)
if (osl_atomic_increment( &pTDR->pType->nRefCount ) > 1)
{
// The refence is incremented. The object cannot be destroyed.
// Release the guard at the earliest point.
@ -1694,7 +1685,7 @@ extern "C" CPPU_DLLPUBLIC void SAL_CALL typelib_typedescription_register(
else
{
// destruction of this type in progress (another thread!)
osl_decrementInterlockedCount( &pTDR->pType->nRefCount );
osl_atomic_decrement( &pTDR->pType->nRefCount );
}
}
// take new descr
@ -2353,7 +2344,7 @@ extern "C" CPPU_DLLPUBLIC void SAL_CALL typelib_typedescriptionreference_new(
{
typelib_TypeDescriptionReference * pTDR = new typelib_TypeDescriptionReference();
#if OSL_DEBUG_LEVEL > 1
osl_incrementInterlockedCount( &rInit.nTypeDescriptionReferenceCount );
osl_atomic_increment( &rInit.nTypeDescriptionReferenceCount );
#endif
pTDR->nRefCount = 1;
pTDR->nStaticRefCount = 0;
@ -2384,7 +2375,7 @@ extern "C" CPPU_DLLPUBLIC void SAL_CALL typelib_typedescriptionreference_acquire
typelib_TypeDescriptionReference * pRef )
SAL_THROW_EXTERN_C()
{
::osl_incrementInterlockedCount( &pRef->nRefCount );
osl_atomic_increment( &pRef->nRefCount );
}
//------------------------------------------------------------------------
@ -2395,7 +2386,7 @@ extern "C" CPPU_DLLPUBLIC void SAL_CALL typelib_typedescriptionreference_release
// Is it a type description?
if( reallyWeak( pRef->eTypeClass ) )
{
if( ! ::osl_decrementInterlockedCount( &pRef->nRefCount ) )
if( ! osl_atomic_decrement( &pRef->nRefCount ) )
{
TypeDescriptor_Init_Impl &rInit = Init::get();
if( rInit.pWeakMap )
@ -2412,7 +2403,7 @@ extern "C" CPPU_DLLPUBLIC void SAL_CALL typelib_typedescriptionreference_release
rtl_uString_release( pRef->pTypeName );
OSL_ASSERT( pRef->pType == 0 );
#if OSL_DEBUG_LEVEL > 1
osl_decrementInterlockedCount( &rInit.nTypeDescriptionReferenceCount );
osl_atomic_decrement( &rInit.nTypeDescriptionReferenceCount );
#endif
delete pRef;
}
@ -2437,7 +2428,7 @@ extern "C" CPPU_DLLPUBLIC void SAL_CALL typelib_typedescriptionreference_getDesc
if( !reallyWeak( pRef->eTypeClass ) && pRef->pType && pRef->pType->pWeakRef )
{
// reference is a description and initialized
osl_incrementInterlockedCount( &((typelib_TypeDescription *)pRef)->nRefCount );
osl_atomic_increment( &((typelib_TypeDescription *)pRef)->nRefCount );
*ppRet = (typelib_TypeDescription *)pRef;
return;
}
@ -2447,7 +2438,7 @@ extern "C" CPPU_DLLPUBLIC void SAL_CALL typelib_typedescriptionreference_getDesc
// pRef->pType->pWeakRef == 0 means that the description is empty
if( pRef->pType && pRef->pType->pWeakRef )
{
sal_Int32 n = ::osl_incrementInterlockedCount( &pRef->pType->nRefCount );
sal_Int32 n = osl_atomic_increment( &pRef->pType->nRefCount );
if( n > 1 )
{
// The refence is incremented. The object cannot be destroyed.
@ -2457,7 +2448,7 @@ extern "C" CPPU_DLLPUBLIC void SAL_CALL typelib_typedescriptionreference_getDesc
}
else
{
::osl_decrementInterlockedCount( &pRef->pType->nRefCount );
osl_atomic_decrement( &pRef->pType->nRefCount );
// detruction of this type in progress (another thread!)
// no acces through this weak reference
pRef->pType = 0;
@ -2489,7 +2480,7 @@ extern "C" void SAL_CALL typelib_typedescriptionreference_getByName(
WeakMap_Impl::const_iterator aIt = rInit.pWeakMap->find( (sal_Unicode*)pName->buffer );
if( !(aIt == rInit.pWeakMap->end()) ) // != failed on msc4.2
{
sal_Int32 n = ::osl_incrementInterlockedCount( &(*aIt).second->nRefCount );
sal_Int32 n = osl_atomic_increment( &(*aIt).second->nRefCount );
if( n > 1 )
{
// The refence is incremented. The object cannot be destroyed.
@ -2500,7 +2491,7 @@ extern "C" void SAL_CALL typelib_typedescriptionreference_getByName(
{
// detruction of this type in progress (another thread!)
// no acces through this weak reference
::osl_decrementInterlockedCount( &(*aIt).second->nRefCount );
osl_atomic_decrement( &(*aIt).second->nRefCount );
}
}
}

View File

@ -47,7 +47,7 @@ static void SAL_CALL s_acquire(uno_Mapping * pMapping) SAL_THROW(())
{
static rtl::OUString s_purpose;
if (1 == ::osl_incrementInterlockedCount(&static_cast<IdentityMapping *>(pMapping)->m_nRef))
if (1 == osl_atomic_increment(&static_cast<IdentityMapping *>(pMapping)->m_nRef))
{
uno_registerMapping(
&pMapping,
@ -60,7 +60,7 @@ static void SAL_CALL s_acquire(uno_Mapping * pMapping) SAL_THROW(())
static void SAL_CALL s_release(uno_Mapping * pMapping) SAL_THROW(())
{
if (!::osl_decrementInterlockedCount(&static_cast<IdentityMapping *>(pMapping )->m_nRef))
if (!osl_atomic_decrement(&static_cast<IdentityMapping *>(pMapping )->m_nRef))
uno_revokeMapping(pMapping);
}

View File

@ -196,8 +196,7 @@ inline sal_Bool _assignArray(
case typelib_TypeClass_SEQUENCE:
for (i=0; i < nTotalElements; i++)
{
::osl_incrementInterlockedCount(
&(*((uno_Sequence **)pSource + i))->nRefCount );
osl_atomic_increment( &(*((uno_Sequence **)pSource + i))->nRefCount );
idestructSequence(
*((uno_Sequence **)pDest + i),
pElementTypeRef, pElementTypeDescr, release );
@ -566,8 +565,7 @@ inline sal_Bool _assignData(
return sal_True;
if (_type_equals( pDestType, pSourceType ))
{
::osl_incrementInterlockedCount(
&(*(uno_Sequence **)pSource)->nRefCount );
osl_atomic_increment( &(*(uno_Sequence **)pSource)->nRefCount );
idestructSequence(
*(uno_Sequence **)pDest, pDestType, pDestTypeDescr, release );
*(uno_Sequence **)pDest = *(uno_Sequence **)pSource;

View File

@ -115,14 +115,14 @@ void MediatorMapping::acquire(void)
{
LOG_LIFECYLE_MediatorMapping_emit(std::cerr << __FUNCTION__ << std::endl);
osl_incrementInterlockedCount(&m_refCount);
osl_atomic_increment(&m_refCount);
}
void MediatorMapping::release(void)
{
LOG_LIFECYLE_MediatorMapping_emit(std::cerr << __FUNCTION__ << std::endl);
if (osl_decrementInterlockedCount(&m_refCount) == 0)
if (osl_atomic_decrement(&m_refCount) == 0)
{
::uno_revokeMapping(this);
}

View File

@ -506,7 +506,7 @@ inline uno_Sequence * icopyConstructSequence(
(eTypeClass <= typelib_TypeClass_ENUM &&
eTypeClass != typelib_TypeClass_ANY))
{
::osl_incrementInterlockedCount( &pSource->nRefCount );
osl_atomic_increment( &pSource->nRefCount );
return pSource;
}
else // create new sequence
@ -828,7 +828,7 @@ inline void _copyConstructData(
}
else
{
::osl_incrementInterlockedCount( &(*(uno_Sequence **)pSource)->nRefCount );
osl_atomic_increment( &(*(uno_Sequence **)pSource)->nRefCount );
*(uno_Sequence **)pDest = *(uno_Sequence **)pSource;
}
break;

View File

@ -327,7 +327,7 @@ inline void idestructSequence(
typelib_TypeDescription * pTypeDescr,
uno_ReleaseFunc release )
{
if (::osl_decrementInterlockedCount( &pSeq->nRefCount ) == 0)
if (osl_atomic_decrement( &pSeq->nRefCount ) == 0)
{
if (pSeq->nElements > 0)
{

View File

@ -537,15 +537,15 @@ static void SAL_CALL defenv_getRegisteredInterfaces(
static void SAL_CALL defenv_acquire( uno_Environment * pEnv )
{
uno_DefaultEnvironment * that = (uno_DefaultEnvironment *)pEnv;
::osl_incrementInterlockedCount( &that->nWeakRef );
::osl_incrementInterlockedCount( &that->nRef );
osl_atomic_increment( &that->nWeakRef );
osl_atomic_increment( &that->nRef );
}
//------------------------------------------------------------------------------
static void SAL_CALL defenv_release( uno_Environment * pEnv )
{
uno_DefaultEnvironment * that = (uno_DefaultEnvironment *)pEnv;
if (! ::osl_decrementInterlockedCount( &that->nRef ))
if (! osl_atomic_decrement( &that->nRef ))
{
// invoke dispose callback
if (pEnv->environmentDisposing)
@ -556,7 +556,7 @@ static void SAL_CALL defenv_release( uno_Environment * pEnv )
OSL_ENSURE( that->aOId2ObjectMap.empty(), "### object entries left!" );
}
// free memory if no weak refs left
if (! ::osl_decrementInterlockedCount( &that->nWeakRef ))
if (! osl_atomic_decrement( &that->nWeakRef ))
{
delete that;
}
@ -566,14 +566,14 @@ static void SAL_CALL defenv_release( uno_Environment * pEnv )
static void SAL_CALL defenv_acquireWeak( uno_Environment * pEnv )
{
uno_DefaultEnvironment * that = (uno_DefaultEnvironment *)pEnv;
::osl_incrementInterlockedCount( &that->nWeakRef );
osl_atomic_increment( &that->nWeakRef );
}
//------------------------------------------------------------------------------
static void SAL_CALL defenv_releaseWeak( uno_Environment * pEnv )
{
uno_DefaultEnvironment * that = (uno_DefaultEnvironment *)pEnv;
if (! ::osl_decrementInterlockedCount( &that->nWeakRef ))
if (! osl_atomic_decrement( &that->nWeakRef ))
{
delete that;
}
@ -597,13 +597,13 @@ static void SAL_CALL defenv_harden(
uno_DefaultEnvironment * that = (uno_DefaultEnvironment *)pEnv;
{
::osl::MutexGuard guard( rData.mutex );
if (1 == ::osl_incrementInterlockedCount( &that->nRef )) // is dead
if (1 == osl_atomic_increment( &that->nRef )) // is dead
{
that->nRef = 0;
return;
}
}
::osl_incrementInterlockedCount( &that->nWeakRef );
osl_atomic_increment( &that->nWeakRef );
*ppHardEnv = pEnv;
}

View File

@ -205,7 +205,7 @@ static void SAL_CALL mediate_free( uno_Mapping * pMapping )
static void SAL_CALL mediate_acquire( uno_Mapping * pMapping )
SAL_THROW(())
{
if (1 == ::osl_incrementInterlockedCount(
if (1 == ::osl_atomic_increment(
& static_cast< uno_Mediate_Mapping * >( pMapping )->nRef ))
{
uno_registerMapping(
@ -219,7 +219,7 @@ static void SAL_CALL mediate_acquire( uno_Mapping * pMapping )
static void SAL_CALL mediate_release( uno_Mapping * pMapping )
SAL_THROW(())
{
if (! ::osl_decrementInterlockedCount(
if (! ::osl_atomic_decrement(
& static_cast< uno_Mediate_Mapping * >( pMapping )->nRef ))
{
uno_revokeMapping( pMapping );

View File

@ -116,7 +116,7 @@ inline sal_uInt32 calcSeqMemSize(
//--------------------------------------------------------------------------------------------------
inline uno_Sequence * createEmptySequence() SAL_THROW(())
{
::osl_incrementInterlockedCount( &g_emptySeq.nRefCount );
osl_atomic_increment( &g_emptySeq.nRefCount );
return &g_emptySeq;
}
//--------------------------------------------------------------------------------------------------
@ -144,7 +144,7 @@ inline typelib_TypeDescriptionReference * _getVoidType()
//--------------------------------------------------------------------------------------------------
#define TYPE_ACQUIRE( pType ) \
::osl_incrementInterlockedCount( &(pType)->nRefCount );
osl_atomic_increment( &(pType)->nRefCount );
//--------------------------------------------------------------------------------------------------
extern "C" void * binuno_queryInterface(

View File

@ -720,7 +720,7 @@ static inline bool ireallocSequence(
if (ret)
{
// destruct sequence
if (osl_decrementInterlockedCount( &pSeq->nRefCount ) == 0)
if (osl_atomic_decrement( &pSeq->nRefCount ) == 0)
{
if (nElements > 0)
{
@ -926,7 +926,7 @@ sal_Bool SAL_CALL uno_type_sequence_reference2One(
if (ret)
{
// easy destruction of empty sequence:
if (osl_decrementInterlockedCount( &pSequence->nRefCount ) == 0)
if (osl_atomic_decrement( &pSequence->nRefCount ) == 0)
rtl_freeMemory( pSequence );
*ppSequence = pNew;
}
@ -969,7 +969,7 @@ sal_Bool SAL_CALL uno_sequence_reference2One(
if (ret)
{
// easy destruction of empty sequence:
if (osl_decrementInterlockedCount( &pSequence->nRefCount ) == 0)
if (osl_atomic_decrement( &pSequence->nRefCount ) == 0)
rtl_freeMemory( pSequence );
*ppSequence = pNew;
}
@ -989,7 +989,7 @@ void SAL_CALL uno_sequence_assign(
{
if (*ppDest != pSource)
{
::osl_incrementInterlockedCount( &pSource->nRefCount );
osl_atomic_increment( &pSource->nRefCount );
idestructSequence( *ppDest, pTypeDescr->pWeakRef, pTypeDescr, release );
*ppDest = pSource;
}
@ -1005,7 +1005,7 @@ void SAL_CALL uno_type_sequence_assign(
{
if (*ppDest != pSource)
{
::osl_incrementInterlockedCount( &pSource->nRefCount );
osl_atomic_increment( &pSource->nRefCount );
idestructSequence( *ppDest, pType, 0, release );
*ppDest = pSource;
}

View File

@ -85,7 +85,7 @@ void OComponentHelper::release() throw()
Reference<XInterface > x( xDelegator );
if (! x.is())
{
if (osl_decrementInterlockedCount( &m_refCount ) == 0)
if (osl_atomic_decrement( &m_refCount ) == 0)
{
if (! rBHelper.bDisposed)
{
@ -117,7 +117,7 @@ void OComponentHelper::release() throw()
}
}
// restore the reference count
osl_incrementInterlockedCount( &m_refCount );
osl_atomic_increment( &m_refCount );
}
OWeakAggObject::release();
}

View File

@ -796,7 +796,7 @@ ComponentContext::ComponentContext(
Reference< lang::XMultiComponentFactory > xMgr( m_xDelegate->getServiceManager() );
if (xMgr.is())
{
osl_incrementInterlockedCount( &m_refCount );
osl_atomic_increment( &m_refCount );
try
{
// create new smgr based on delegate's one
@ -815,10 +815,10 @@ ComponentContext::ComponentContext(
}
catch (...)
{
osl_decrementInterlockedCount( &m_refCount );
osl_atomic_decrement( &m_refCount );
throw;
}
osl_decrementInterlockedCount( &m_refCount );
osl_atomic_decrement( &m_refCount );
OSL_ASSERT( m_xSMgr.is() );
}
}

View File

@ -238,11 +238,11 @@ void WeakComponentImplHelperBase::acquire()
void WeakComponentImplHelperBase::release()
throw ()
{
if (osl_decrementInterlockedCount( &m_refCount ) == 0) {
if (osl_atomic_decrement( &m_refCount ) == 0) {
// ensure no other references are created, via the weak connection point, from now on
disposeWeakConnectionPoint();
// restore reference count:
osl_incrementInterlockedCount( &m_refCount );
osl_atomic_increment( &m_refCount );
if (! rBHelper.bDisposed) {
try {
dispose();
@ -374,11 +374,11 @@ void WeakAggComponentImplHelperBase::release()
if (xDelegator_.is()) {
OWeakAggObject::release();
}
else if (osl_decrementInterlockedCount( &m_refCount ) == 0) {
else if (osl_atomic_decrement( &m_refCount ) == 0) {
// ensure no other references are created, via the weak connection point, from now on
disposeWeakConnectionPoint();
// restore reference count:
osl_incrementInterlockedCount( &m_refCount );
osl_atomic_increment( &m_refCount );
if (! rBHelper.bDisposed) {
try {
dispose();

View File

@ -100,13 +100,13 @@ Any SAL_CALL OWeakConnectionPoint::queryInterface( const Type & rType )
// XInterface
void SAL_CALL OWeakConnectionPoint::acquire() throw()
{
osl_incrementInterlockedCount( &m_aRefCount );
osl_atomic_increment( &m_aRefCount );
}
// XInterface
void SAL_CALL OWeakConnectionPoint::release() throw()
{
if (! osl_decrementInterlockedCount( &m_aRefCount ))
if (! osl_atomic_decrement( &m_aRefCount ))
delete this;
}
@ -141,7 +141,7 @@ Reference< XInterface > SAL_CALL OWeakConnectionPoint::queryAdapted() throw(::co
if (m_pObject)
{
oslInterlockedCount n = osl_incrementInterlockedCount( &m_pObject->m_refCount );
oslInterlockedCount n = osl_atomic_increment( &m_pObject->m_refCount );
if (n > 1)
{
@ -150,11 +150,11 @@ Reference< XInterface > SAL_CALL OWeakConnectionPoint::queryAdapted() throw(::co
guard.clear();
// WeakObject has a (XInterface *) cast operator
ret = *m_pObject;
n = osl_decrementInterlockedCount( &m_pObject->m_refCount );
n = osl_atomic_decrement( &m_pObject->m_refCount );
}
else
// Another thread wait in the dispose method at the guard
n = osl_decrementInterlockedCount( &m_pObject->m_refCount );
n = osl_atomic_decrement( &m_pObject->m_refCount );
}
return ret;
@ -199,13 +199,13 @@ Any SAL_CALL OWeakObject::queryInterface( const Type & rType ) throw(::com::sun:
// XInterface
void SAL_CALL OWeakObject::acquire() throw()
{
osl_incrementInterlockedCount( &m_refCount );
osl_atomic_increment( &m_refCount );
}
// XInterface
void SAL_CALL OWeakObject::release() throw()
{
if (osl_decrementInterlockedCount( &m_refCount ) == 0) {
if (osl_atomic_decrement( &m_refCount ) == 0) {
// notify/clear all weak-refs before object's dtor is executed
// (which may check weak-refs to this object):
disposeWeakConnectionPoint();
@ -363,7 +363,7 @@ OWeakRefListener::OWeakRefListener(const OWeakRefListener& rRef) SAL_THROW(())
}
}
catch (RuntimeException &) { OSL_ASSERT( 0 ); } // assert here, but no unexpected()
osl_decrementInterlockedCount( &m_aRefCount );
osl_atomic_decrement( &m_aRefCount );
}
OWeakRefListener::OWeakRefListener(const Reference< XInterface >& xInt) SAL_THROW(())
@ -384,7 +384,7 @@ OWeakRefListener::OWeakRefListener(const Reference< XInterface >& xInt) SAL_THRO
}
}
catch (RuntimeException &) { OSL_ASSERT( 0 ); } // assert here, but no unexpected()
osl_decrementInterlockedCount( &m_aRefCount );
osl_atomic_decrement( &m_aRefCount );
}
OWeakRefListener::~OWeakRefListener() SAL_THROW(())
@ -410,13 +410,13 @@ Any SAL_CALL OWeakRefListener::queryInterface( const Type & rType ) throw(Runtim
// XInterface
void SAL_CALL OWeakRefListener::acquire() throw()
{
osl_incrementInterlockedCount( &m_aRefCount );
osl_atomic_increment( &m_aRefCount );
}
// XInterface
void SAL_CALL OWeakRefListener::release() throw()
{
if( ! osl_decrementInterlockedCount( &m_aRefCount ) )
if( ! osl_atomic_decrement( &m_aRefCount ) )
delete this;
}

View File

@ -1026,7 +1026,7 @@ static IMPL_RTL_STRCODE* IMPL_RTL_STRINGNAME( ImplNewCopy )( IMPL_RTL_STRINGDATA
#define IMPL_RTL_AQUIRE( pThis ) \
{ \
if (!SAL_STRING_IS_STATIC (pThis)) \
osl_incrementInterlockedCount( &((pThis)->refCount) ); \
osl_atomic_increment( &((pThis)->refCount) ); \
}
/* ----------------------------------------------------------------------- */
@ -1055,7 +1055,7 @@ void SAL_CALL IMPL_RTL_STRINGNAME( release )( IMPL_RTL_STRINGDATA* pThis )
#endif
if ( pThis->refCount == 1 ||
!osl_decrementInterlockedCount( &(pThis->refCount) ) )
!osl_atomic_decrement( &(pThis->refCount) ) )
{
RTL_LOG_STRING_DELETE( pThis );
rtl_freeMemory( pThis );

View File

@ -951,7 +951,7 @@ internRelease (rtl_uString *pThis)
rtl_uString *pFree = NULL;
if ( SAL_STRING_REFCOUNT(
osl_decrementInterlockedCount( &(pThis->refCount) ) ) == 0)
osl_atomic_decrement( &(pThis->refCount) ) ) == 0)
{
pPoolMutex = getInternMutex();
osl_acquireMutex( pPoolMutex );
@ -960,7 +960,7 @@ internRelease (rtl_uString *pThis)
/* May have been separately acquired */
if ( SAL_STRING_REFCOUNT(
osl_incrementInterlockedCount( &(pThis->refCount) ) ) == 1 )
osl_atomic_increment( &(pThis->refCount) ) ) == 1 )
{
/* we got the last ref */
pFree = pThis;

View File

@ -81,7 +81,7 @@ sal_Bool SAL_CALL OStoreObject::isKindOf (sal_uInt32 nTypeId)
*/
oslInterlockedCount SAL_CALL OStoreObject::acquire (void)
{
oslInterlockedCount result = osl_incrementInterlockedCount (&m_nRefCount);
oslInterlockedCount result = osl_atomic_increment (&m_nRefCount);
return (result);
}
@ -90,7 +90,7 @@ oslInterlockedCount SAL_CALL OStoreObject::acquire (void)
*/
oslInterlockedCount SAL_CALL OStoreObject::release (void)
{
oslInterlockedCount result = osl_decrementInterlockedCount (&m_nRefCount);
oslInterlockedCount result = osl_atomic_decrement (&m_nRefCount);
if (result == 0)
{
// Last reference released.