From 750fc206113a796035cbc05fb904fbae0eb771a8 Mon Sep 17 00:00:00 2001 From: Norbert Thiebaud Date: Sat, 22 Sep 2012 01:51:12 -0500 Subject: replace remaining InterlockedCount() with inlined version Change-Id: Ifcfa48fc87f905a91470a5b0fd597b02f220784c Reviewed-on: https://gerrit.libreoffice.org/671 Tested-by: Norbert Thiebaud Reviewed-by: Norbert Thiebaud --- bridges/inc/bridges/cpp_uno/bridge.hxx | 12 ++++++------ bridges/source/cpp_uno/shared/bridge.cxx | 4 ++-- bridges/source/cpp_uno/shared/cppinterfaceproxy.cxx | 4 ++-- bridges/source/cpp_uno/shared/unointerfaceproxy.cxx | 4 ++-- bridges/source/jni_uno/jni_bridge.cxx | 4 ++-- bridges/source/jni_uno/jni_uno2java.cxx | 4 ++-- bridges/test/java_uno/acquire/testacquire.cxx | 4 ++-- bridges/test/performance/testperformance.cxx | 2 +- bridges/test/testcomp.cxx | 4 ++-- 9 files changed, 21 insertions(+), 21 deletions(-) (limited to 'bridges') diff --git a/bridges/inc/bridges/cpp_uno/bridge.hxx b/bridges/inc/bridges/cpp_uno/bridge.hxx index 14126647c518..96af924e734a 100644 --- a/bridges/inc/bridges/cpp_uno/bridge.hxx +++ b/bridges/inc/bridges/cpp_uno/bridge.hxx @@ -102,7 +102,7 @@ inline void SAL_CALL cppu_Mapping_uno2cpp( //__________________________________________________________________________________________________ inline void cppu_cppInterfaceProxy::acquireProxy() SAL_THROW(()) { - if (1 == osl_incrementInterlockedCount( &nRef )) + if (1 == osl_atomic_increment( &nRef )) { // rebirth of proxy zombie // register at cpp env @@ -116,7 +116,7 @@ inline void cppu_cppInterfaceProxy::acquireProxy() SAL_THROW(()) //__________________________________________________________________________________________________ inline void cppu_cppInterfaceProxy::releaseProxy() SAL_THROW(()) { - if (! osl_decrementInterlockedCount( &nRef )) // last release + if (! osl_atomic_decrement( &nRef )) // last release { // revoke from cpp env (*pBridge->pCppEnv->revokeInterface)( @@ -170,7 +170,7 @@ inline void SAL_CALL cppu_unoInterfaceProxy_free( uno_ExtEnvironment * pEnv, voi //-------------------------------------------------------------------------------------------------- inline void SAL_CALL cppu_unoInterfaceProxy_acquire( uno_Interface * pUnoI ) SAL_THROW(()) { - if (1 == osl_incrementInterlockedCount( & static_cast< cppu_unoInterfaceProxy * >( pUnoI )->nRef )) + if (1 == osl_atomic_increment( & static_cast< cppu_unoInterfaceProxy * >( pUnoI )->nRef )) { // rebirth of proxy zombie // register at uno env @@ -191,7 +191,7 @@ inline void SAL_CALL cppu_unoInterfaceProxy_acquire( uno_Interface * pUnoI ) SAL //-------------------------------------------------------------------------------------------------- inline void SAL_CALL cppu_unoInterfaceProxy_release( uno_Interface * pUnoI ) SAL_THROW(()) { - if (! osl_decrementInterlockedCount( & static_cast< cppu_unoInterfaceProxy * >( pUnoI )->nRef )) + if (! osl_atomic_decrement( & static_cast< cppu_unoInterfaceProxy * >( pUnoI )->nRef )) { // revoke from uno env on last release (*static_cast< cppu_unoInterfaceProxy * >( pUnoI )->pBridge->pUnoEnv->revokeInterface)( @@ -320,7 +320,7 @@ inline void SAL_CALL cppu_Bridge_free( uno_Mapping * pMapping ) SAL_THROW(()) //__________________________________________________________________________________________________ inline void cppu_Bridge::acquire() SAL_THROW(()) { - if (1 == osl_incrementInterlockedCount( &nRef )) + if (1 == osl_atomic_increment( &nRef )) { if (bExportCpp2Uno) { @@ -341,7 +341,7 @@ inline void cppu_Bridge::acquire() SAL_THROW(()) //__________________________________________________________________________________________________ inline void cppu_Bridge::release() SAL_THROW(()) { - if (! osl_decrementInterlockedCount( &nRef )) + if (! osl_atomic_decrement( &nRef )) { ::uno_revokeMapping( bExportCpp2Uno ? &aCpp2Uno : &aUno2Cpp ); } diff --git a/bridges/source/cpp_uno/shared/bridge.cxx b/bridges/source/cpp_uno/shared/bridge.cxx index 4523f20061a3..cefb62ef3453 100644 --- a/bridges/source/cpp_uno/shared/bridge.cxx +++ b/bridges/source/cpp_uno/shared/bridge.cxx @@ -153,7 +153,7 @@ uno_Mapping * Bridge::createMapping( void Bridge::acquire() SAL_THROW(()) { - if (1 == osl_incrementInterlockedCount( &nRef )) + if (1 == osl_atomic_increment( &nRef )) { if (bExportCpp2Uno) { @@ -174,7 +174,7 @@ void Bridge::acquire() SAL_THROW(()) void Bridge::release() SAL_THROW(()) { - if (! osl_decrementInterlockedCount( &nRef )) + if (! osl_atomic_decrement( &nRef )) { ::uno_revokeMapping( bExportCpp2Uno ? &aCpp2Uno : &aUno2Cpp ); } diff --git a/bridges/source/cpp_uno/shared/cppinterfaceproxy.cxx b/bridges/source/cpp_uno/shared/cppinterfaceproxy.cxx index 36942481fefc..cc8c4d947e8f 100644 --- a/bridges/source/cpp_uno/shared/cppinterfaceproxy.cxx +++ b/bridges/source/cpp_uno/shared/cppinterfaceproxy.cxx @@ -129,7 +129,7 @@ com::sun::star::uno::XInterface * CppInterfaceProxy::create( void CppInterfaceProxy::acquireProxy() SAL_THROW(()) { - if (1 == osl_incrementInterlockedCount( &nRef )) + if (1 == osl_atomic_increment( &nRef )) { // rebirth of proxy zombie // register at cpp env @@ -143,7 +143,7 @@ void CppInterfaceProxy::acquireProxy() SAL_THROW(()) void CppInterfaceProxy::releaseProxy() SAL_THROW(()) { - if (! osl_decrementInterlockedCount( &nRef )) // last release + if (! osl_atomic_decrement( &nRef )) // last release { // revoke from cpp env (*pBridge->getCppEnv()->revokeInterface)( diff --git a/bridges/source/cpp_uno/shared/unointerfaceproxy.cxx b/bridges/source/cpp_uno/shared/unointerfaceproxy.cxx index 247b31454e4d..81353cff7682 100644 --- a/bridges/source/cpp_uno/shared/unointerfaceproxy.cxx +++ b/bridges/source/cpp_uno/shared/unointerfaceproxy.cxx @@ -54,7 +54,7 @@ void freeUnoInterfaceProxy(uno_ExtEnvironment * pEnv, void * pProxy) void acquireProxy(uno_Interface * pUnoI) { - if (1 == osl_incrementInterlockedCount( + if (1 == osl_atomic_increment( & static_cast< UnoInterfaceProxy * >( pUnoI )->nRef )) { // rebirth of proxy zombie @@ -76,7 +76,7 @@ void acquireProxy(uno_Interface * pUnoI) void releaseProxy(uno_Interface * pUnoI) { - if (! osl_decrementInterlockedCount( + if (! osl_atomic_decrement( & static_cast< UnoInterfaceProxy * >( pUnoI )->nRef )) { // revoke from uno env on last release diff --git a/bridges/source/jni_uno/jni_bridge.cxx b/bridges/source/jni_uno/jni_bridge.cxx index be46d1de64fd..51ab45939738 100644 --- a/bridges/source/jni_uno/jni_bridge.cxx +++ b/bridges/source/jni_uno/jni_bridge.cxx @@ -214,7 +214,7 @@ namespace jni_uno //______________________________________________________________________________ void Bridge::acquire() const SAL_THROW(()) { - if (1 == osl_incrementInterlockedCount( &m_ref )) + if (1 == osl_atomic_increment( &m_ref )) { if (m_registered_java2uno) { @@ -236,7 +236,7 @@ void Bridge::acquire() const SAL_THROW(()) //______________________________________________________________________________ void Bridge::release() const SAL_THROW(()) { - if (! osl_decrementInterlockedCount( &m_ref )) + if (! osl_atomic_decrement( &m_ref )) { uno_revokeMapping( m_registered_java2uno diff --git a/bridges/source/jni_uno/jni_uno2java.cxx b/bridges/source/jni_uno/jni_uno2java.cxx index b38aad90391f..a7ae60cb02a7 100644 --- a/bridges/source/jni_uno/jni_uno2java.cxx +++ b/bridges/source/jni_uno/jni_uno2java.cxx @@ -479,7 +479,7 @@ inline UNO_proxy::UNO_proxy( //______________________________________________________________________________ inline void UNO_proxy::acquire() const { - if (1 == osl_incrementInterlockedCount( &m_ref )) + if (1 == osl_atomic_increment( &m_ref )) { // rebirth of proxy zombie void * that = const_cast< UNO_proxy * >( this ); @@ -497,7 +497,7 @@ inline void UNO_proxy::acquire() const //______________________________________________________________________________ inline void UNO_proxy::release() const { - if (0 == osl_decrementInterlockedCount( &m_ref )) + if (0 == osl_atomic_decrement( &m_ref )) { // revoke from uno env on last release (*m_bridge->m_uno_env->revokeInterface)( diff --git a/bridges/test/java_uno/acquire/testacquire.cxx b/bridges/test/java_uno/acquire/testacquire.cxx index fcf7fde15099..f3216fb15a07 100644 --- a/bridges/test/java_uno/acquire/testacquire.cxx +++ b/bridges/test/java_uno/acquire/testacquire.cxx @@ -99,7 +99,7 @@ public: throw (css::uno::RuntimeException); virtual void SAL_CALL acquire() throw () - { osl_incrementInterlockedCount(&m_refCount); } + { osl_atomic_increment(&m_refCount); } virtual void SAL_CALL release() throw (); @@ -125,7 +125,7 @@ css::uno::Any Interface::queryInterface(css::uno::Type const & type) } void Interface::release() throw () { - if (osl_decrementInterlockedCount(&m_refCount) == 0) { + if (osl_atomic_decrement(&m_refCount) == 0) { delete this; } } diff --git a/bridges/test/performance/testperformance.cxx b/bridges/test/performance/testperformance.cxx index 87fcd910cb11..36102aca31c4 100644 --- a/bridges/test/performance/testperformance.cxx +++ b/bridges/test/performance/testperformance.cxx @@ -95,7 +95,7 @@ void main() oslInterlockedCount count; for( int i = 0 ; i < 1000*10000 ; i ++ ) { - osl_incrementInterlockedCount( &count ); + osl_atomic_increment( &count ); } } { diff --git a/bridges/test/testcomp.cxx b/bridges/test/testcomp.cxx index 26885b295224..16fa2d4958d9 100644 --- a/bridges/test/testcomp.cxx +++ b/bridges/test/testcomp.cxx @@ -157,9 +157,9 @@ public: return aRet; } virtual void SAL_CALL acquire() throw() - { osl_incrementInterlockedCount( &_nRef ); } + { osl_atomic_increment( &_nRef ); } virtual void SAL_CALL release() throw() - { if (! osl_decrementInterlockedCount( &_nRef )) delete this; } + { if (! osl_atomic_decrement( &_nRef )) delete this; } // XServiceInfo virtual OUString SAL_CALL getImplementationName() throw (RuntimeException); -- cgit