diff options
38 files changed, 204 insertions, 154 deletions
diff --git a/comphelper/Library_comphelper.mk b/comphelper/Library_comphelper.mk index 0746889742b2..09a68895f81f 100644 --- a/comphelper/Library_comphelper.mk +++ b/comphelper/Library_comphelper.mk @@ -106,6 +106,7 @@ $(eval $(call gb_Library_add_exception_objects,comphelper,\ comphelper/source/misc/servicedecl \ comphelper/source/misc/serviceinfohelper \ comphelper/source/misc/sharedmutex \ + comphelper/source/misc/solarmutex \ comphelper/source/misc/stillreadwriteinteraction \ comphelper/source/misc/anycompare \ comphelper/source/misc/storagehelper \ diff --git a/comphelper/source/misc/solarmutex.cxx b/comphelper/source/misc/solarmutex.cxx new file mode 100644 index 000000000000..af17a9a39347 --- /dev/null +++ b/comphelper/source/misc/solarmutex.cxx @@ -0,0 +1,28 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "sal/config.h" + +#include "comphelper/solarmutex.hxx" + +comphelper::SolarMutex::SolarMutex() {} + +comphelper::SolarMutex::~SolarMutex() {} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/property/ChainablePropertySet.cxx b/comphelper/source/property/ChainablePropertySet.cxx index cd078a9f59e9..c4cc545d63a6 100644 --- a/comphelper/source/property/ChainablePropertySet.cxx +++ b/comphelper/source/property/ChainablePropertySet.cxx @@ -19,7 +19,7 @@ #include <comphelper/ChainablePropertySet.hxx> #include <comphelper/ChainablePropertySetInfo.hxx> -#include <osl/mutex.hxx> +#include <comphelper/solarmutex.hxx> #include <boost/scoped_ptr.hpp> @@ -31,7 +31,7 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::beans; -ChainablePropertySet::ChainablePropertySet( comphelper::ChainablePropertySetInfo* pInfo, osl::SolarMutex* pMutex ) +ChainablePropertySet::ChainablePropertySet( comphelper::ChainablePropertySetInfo* pInfo, comphelper::SolarMutex* pMutex ) throw() : mpInfo ( pInfo ) , mpMutex ( pMutex ) @@ -55,9 +55,9 @@ void SAL_CALL ChainablePropertySet::setPropertyValue( const OUString& rPropertyN throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException) { // acquire mutex in c-tor and releases it in the d-tor (exception safe!). - boost::scoped_ptr< osl::SolarGuard > pMutexGuard; + boost::scoped_ptr< osl::Guard< comphelper::SolarMutex > > pMutexGuard; if (mpMutex) - pMutexGuard.reset( new osl::SolarGuard(mpMutex) ); + pMutexGuard.reset( new osl::Guard< comphelper::SolarMutex >(mpMutex) ); PropertyInfoHash::const_iterator aIter = mpInfo->maMap.find ( rPropertyName ); @@ -73,9 +73,9 @@ Any SAL_CALL ChainablePropertySet::getPropertyValue( const OUString& rPropertyNa throw(UnknownPropertyException, WrappedTargetException, RuntimeException) { // acquire mutex in c-tor and releases it in the d-tor (exception safe!). - boost::scoped_ptr< osl::SolarGuard > pMutexGuard; + boost::scoped_ptr< osl::Guard< comphelper::SolarMutex > > pMutexGuard; if (mpMutex) - pMutexGuard.reset( new osl::SolarGuard(mpMutex) ); + pMutexGuard.reset( new osl::Guard< comphelper::SolarMutex >(mpMutex) ); PropertyInfoHash::const_iterator aIter = mpInfo->maMap.find ( rPropertyName ); @@ -119,9 +119,9 @@ void SAL_CALL ChainablePropertySet::setPropertyValues( const Sequence< OUString throw(PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException) { // acquire mutex in c-tor and releases it in the d-tor (exception safe!). - boost::scoped_ptr< osl::SolarGuard > pMutexGuard; + boost::scoped_ptr< osl::Guard< comphelper::SolarMutex > > pMutexGuard; if (mpMutex) - pMutexGuard.reset( new osl::SolarGuard(mpMutex) ); + pMutexGuard.reset( new osl::Guard< comphelper::SolarMutex >(mpMutex) ); const sal_Int32 nCount = aPropertyNames.getLength(); @@ -153,9 +153,9 @@ Sequence< Any > SAL_CALL ChainablePropertySet::getPropertyValues( const Sequence throw(RuntimeException) { // acquire mutex in c-tor and releases it in the d-tor (exception safe!). - boost::scoped_ptr< osl::SolarGuard > pMutexGuard; + boost::scoped_ptr< osl::Guard< comphelper::SolarMutex > > pMutexGuard; if (mpMutex) - pMutexGuard.reset( new osl::SolarGuard(mpMutex) ); + pMutexGuard.reset( new osl::Guard< comphelper::SolarMutex >(mpMutex) ); const sal_Int32 nCount = aPropertyNames.getLength(); diff --git a/comphelper/source/property/MasterPropertySet.cxx b/comphelper/source/property/MasterPropertySet.cxx index f996e8b1fc7d..6477e11ee329 100644 --- a/comphelper/source/property/MasterPropertySet.cxx +++ b/comphelper/source/property/MasterPropertySet.cxx @@ -22,7 +22,7 @@ #include <comphelper/MasterPropertySetInfo.hxx> #include <comphelper/ChainablePropertySet.hxx> #include <comphelper/ChainablePropertySetInfo.hxx> -#include <osl/mutex.hxx> +#include <comphelper/solarmutex.hxx> #include <boost/scoped_ptr.hpp> @@ -30,16 +30,16 @@ class AutoOGuardArray { - boost::scoped_ptr< osl::SolarGuard > * mpGuardArray; + boost::scoped_ptr< osl::Guard< comphelper::SolarMutex > > * mpGuardArray; public: AutoOGuardArray( sal_Int32 nNumElements ); ~AutoOGuardArray(); - boost::scoped_ptr< osl::SolarGuard > & operator[] ( sal_Int32 i ) { return mpGuardArray[i]; } + boost::scoped_ptr< osl::Guard< comphelper::SolarMutex > > & operator[] ( sal_Int32 i ) { return mpGuardArray[i]; } }; -AutoOGuardArray::AutoOGuardArray( sal_Int32 nNumElements ) : mpGuardArray(new boost::scoped_ptr< osl::SolarGuard >[nNumElements]) +AutoOGuardArray::AutoOGuardArray( sal_Int32 nNumElements ) : mpGuardArray(new boost::scoped_ptr< osl::Guard< comphelper::SolarMutex > >[nNumElements]) { } @@ -67,7 +67,7 @@ SlaveData::SlaveData ( ChainablePropertySet *pSlave) { } -MasterPropertySet::MasterPropertySet( comphelper::MasterPropertySetInfo* pInfo, osl::SolarMutex* pMutex ) +MasterPropertySet::MasterPropertySet( comphelper::MasterPropertySetInfo* pInfo, comphelper::SolarMutex* pMutex ) throw() : mpInfo ( pInfo ) , mpMutex ( pMutex ) @@ -105,9 +105,9 @@ void SAL_CALL MasterPropertySet::setPropertyValue( const OUString& rPropertyName throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException) { // acquire mutex in c-tor and releases it in the d-tor (exception safe!). - boost::scoped_ptr< osl::SolarGuard > pMutexGuard; + boost::scoped_ptr< osl::Guard< comphelper::SolarMutex > > pMutexGuard; if (mpMutex) - pMutexGuard.reset( new osl::SolarGuard(mpMutex) ); + pMutexGuard.reset( new osl::Guard< comphelper::SolarMutex >(mpMutex) ); PropertyDataHash::const_iterator aIter = mpInfo->maMap.find ( rPropertyName ); @@ -125,9 +125,9 @@ void SAL_CALL MasterPropertySet::setPropertyValue( const OUString& rPropertyName ChainablePropertySet * pSlave = maSlaveMap [ (*aIter).second->mnMapId ]->mpSlave; // acquire mutex in c-tor and releases it in the d-tor (exception safe!). - boost::scoped_ptr< osl::SolarGuard > pMutexGuard2; + boost::scoped_ptr< osl::Guard< comphelper::SolarMutex > > pMutexGuard2; if (pSlave->mpMutex) - pMutexGuard2.reset( new osl::SolarGuard(pSlave->mpMutex) ); + pMutexGuard2.reset( new osl::Guard< comphelper::SolarMutex >(pSlave->mpMutex) ); pSlave->_preSetValues(); pSlave->_setSingleValue( *((*aIter).second->mpInfo), rValue ); @@ -139,9 +139,9 @@ Any SAL_CALL MasterPropertySet::getPropertyValue( const OUString& rPropertyName throw(UnknownPropertyException, WrappedTargetException, RuntimeException) { // acquire mutex in c-tor and releases it in the d-tor (exception safe!). - boost::scoped_ptr< osl::SolarGuard > pMutexGuard; + boost::scoped_ptr< osl::Guard< comphelper::SolarMutex > > pMutexGuard; if (mpMutex) - pMutexGuard.reset( new osl::SolarGuard(mpMutex) ); + pMutexGuard.reset( new osl::Guard< comphelper::SolarMutex >(mpMutex) ); PropertyDataHash::const_iterator aIter = mpInfo->maMap.find ( rPropertyName ); @@ -160,9 +160,9 @@ Any SAL_CALL MasterPropertySet::getPropertyValue( const OUString& rPropertyName ChainablePropertySet * pSlave = maSlaveMap [ (*aIter).second->mnMapId ]->mpSlave; // acquire mutex in c-tor and releases it in the d-tor (exception safe!). - boost::scoped_ptr< osl::SolarGuard > pMutexGuard2; + boost::scoped_ptr< osl::Guard< comphelper::SolarMutex > > pMutexGuard2; if (pSlave->mpMutex) - pMutexGuard2.reset( new osl::SolarGuard(pSlave->mpMutex) ); + pMutexGuard2.reset( new osl::Guard< comphelper::SolarMutex >(pSlave->mpMutex) ); pSlave->_preGetValues(); pSlave->_getSingleValue( *((*aIter).second->mpInfo), aAny ); @@ -200,9 +200,9 @@ void SAL_CALL MasterPropertySet::setPropertyValues( const Sequence< OUString >& throw(PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException) { // acquire mutex in c-tor and releases it in the d-tor (exception safe!). - boost::scoped_ptr< osl::SolarGuard > pMutexGuard; + boost::scoped_ptr< osl::Guard< comphelper::SolarMutex > > pMutexGuard; if (mpMutex) - pMutexGuard.reset( new osl::SolarGuard(mpMutex) ); + pMutexGuard.reset( new osl::Guard< comphelper::SolarMutex >(mpMutex) ); const sal_Int32 nCount = aPropertyNames.getLength(); @@ -239,7 +239,7 @@ void SAL_CALL MasterPropertySet::setPropertyValues( const Sequence< OUString >& { // acquire mutex in c-tor and releases it in the d-tor (exception safe!). if (pSlave->mpSlave->mpMutex) - aOGuardArray[i].reset( new osl::SolarGuard(pSlave->mpSlave->mpMutex) ); + aOGuardArray[i].reset( new osl::Guard< comphelper::SolarMutex >(pSlave->mpSlave->mpMutex) ); pSlave->mpSlave->_preSetValues(); pSlave->SetInit ( sal_True ); @@ -266,9 +266,9 @@ Sequence< Any > SAL_CALL MasterPropertySet::getPropertyValues( const Sequence< O throw(RuntimeException) { // acquire mutex in c-tor and releases it in the d-tor (exception safe!). - boost::scoped_ptr< osl::SolarGuard > pMutexGuard; + boost::scoped_ptr< osl::Guard< comphelper::SolarMutex > > pMutexGuard; if (mpMutex) - pMutexGuard.reset( new osl::SolarGuard(mpMutex) ); + pMutexGuard.reset( new osl::Guard< comphelper::SolarMutex >(mpMutex) ); const sal_Int32 nCount = aPropertyNames.getLength(); @@ -304,7 +304,7 @@ Sequence< Any > SAL_CALL MasterPropertySet::getPropertyValues( const Sequence< O { // acquire mutex in c-tor and releases it in the d-tor (exception safe!). if (pSlave->mpSlave->mpMutex) - aOGuardArray[i].reset( new osl::SolarGuard(pSlave->mpSlave->mpMutex) ); + aOGuardArray[i].reset( new osl::Guard< comphelper::SolarMutex >(pSlave->mpSlave->mpMutex) ); pSlave->mpSlave->_preGetValues(); pSlave->SetInit ( sal_True ); @@ -367,9 +367,9 @@ PropertyState SAL_CALL MasterPropertySet::getPropertyState( const OUString& Prop ChainablePropertySet * pSlave = maSlaveMap [ (*aIter).second->mnMapId ]->mpSlave; // acquire mutex in c-tor and releases it in the d-tor (exception safe!). - boost::scoped_ptr< osl::SolarGuard > pMutexGuard; + boost::scoped_ptr< osl::Guard< comphelper::SolarMutex > > pMutexGuard; if (pSlave->mpMutex) - pMutexGuard.reset( new osl::SolarGuard(pSlave->mpMutex) ); + pMutexGuard.reset( new osl::Guard< comphelper::SolarMutex >(pSlave->mpMutex) ); pSlave->_preGetPropertyState(); pSlave->_getPropertyState( *((*aIter).second->mpInfo), aState ); diff --git a/dbaccess/source/core/dataaccess/ModelImpl.cxx b/dbaccess/source/core/dataaccess/ModelImpl.cxx index 95af6b73e65b..e015e7cbfa78 100644 --- a/dbaccess/source/core/dataaccess/ModelImpl.cxx +++ b/dbaccess/source/core/dataaccess/ModelImpl.cxx @@ -95,19 +95,19 @@ VosMutexFacade::VosMutexFacade( ::osl::Mutex& _rMutex ) { } -void SAL_CALL VosMutexFacade::acquire() +void VosMutexFacade::acquire() { m_rMutex.acquire(); } -sal_Bool SAL_CALL VosMutexFacade::tryToAcquire() +void VosMutexFacade::release() { - return m_rMutex.tryToAcquire(); + m_rMutex.release(); } -void SAL_CALL VosMutexFacade::release() +bool VosMutexFacade::tryToAcquire() { - m_rMutex.release(); + return m_rMutex.tryToAcquire(); } //============================================================ @@ -1194,7 +1194,7 @@ namespace { void lcl_modifyListening( ::sfx2::IModifiableDocument& _rDocument, const Reference< XStorage >& _rxStorage, ::rtl::Reference< ::sfx2::DocumentStorageModifyListener >& _inout_rListener, - ::osl::SolarMutex& _rMutex, bool _bListen ) + comphelper::SolarMutex& _rMutex, bool _bListen ) { Reference< XModifiable > xModify( _rxStorage, UNO_QUERY ); OSL_ENSURE( xModify.is() || !_rxStorage.is(), "lcl_modifyListening: storage can't notify us!" ); diff --git a/dbaccess/source/core/dataaccess/ModelImpl.hxx b/dbaccess/source/core/dataaccess/ModelImpl.hxx index fa595648336c..eff4138ea316 100644 --- a/dbaccess/source/core/dataaccess/ModelImpl.hxx +++ b/dbaccess/source/core/dataaccess/ModelImpl.hxx @@ -62,13 +62,13 @@ #include <comphelper/namedvaluecollection.hxx> #include <comphelper/proparrhlp.hxx> #include <comphelper/sharedmutex.hxx> +#include <comphelper/solarmutex.hxx> #include <connectivity/CommonTools.hxx> #include <cppuhelper/propshlp.hxx> #include <cppuhelper/weakref.hxx> #include <sfx2/docmacromode.hxx> #include <sfx2/docstoragemodifylistener.hxx> #include <unotools/sharedunocomponent.hxx> -#include <osl/mutex.hxx> #include <rtl/ref.hxx> #include <memory> @@ -128,7 +128,7 @@ class OSharedConnectionManager; //============================================================ /** a class which provides an IMutex interface to an OSL-based mutex */ -class VosMutexFacade : public ::osl::SolarMutex +class VosMutexFacade : public comphelper::SolarMutex { public: /** beware of life time: the mutex you pass here must live as least as long @@ -136,10 +136,9 @@ public: */ VosMutexFacade( ::osl::Mutex& _rMutex ); - // IMutex - virtual void SAL_CALL acquire(); - virtual sal_Bool SAL_CALL tryToAcquire(); - virtual void SAL_CALL release(); + virtual void acquire(); + virtual void release(); + virtual bool tryToAcquire(); private: ::osl::Mutex& m_rMutex; diff --git a/fpicker/source/win32/filepicker/SolarMutex.cxx b/fpicker/source/win32/filepicker/SolarMutex.cxx index ed4c28998cc6..c21f994e177f 100644 --- a/fpicker/source/win32/filepicker/SolarMutex.cxx +++ b/fpicker/source/win32/filepicker/SolarMutex.cxx @@ -19,7 +19,7 @@ #include <vcl/svapp.hxx> -#include <osl/mutex.hxx> +#include <comphelper/solarmutex.hxx> #include <osl/thread.hxx> int ReleaseSolarMutexOnMainThreadContext(unsigned nThreadId) @@ -29,7 +29,7 @@ int ReleaseSolarMutexOnMainThreadContext(unsigned nThreadId) if ( nMainThreadId == nThreadId ) { - ::osl::SolarMutex& rMutex = Application::GetSolarMutex(); + comphelper::SolarMutex& rMutex = Application::GetSolarMutex(); if ( rMutex.tryToAcquire() ) nAcquireCount = Application::ReleaseSolarMutex() - 1; } diff --git a/framework/inc/threadhelp/lockhelper.hxx b/framework/inc/threadhelp/lockhelper.hxx index 93641b5817b4..6d7bb24d424f 100644 --- a/framework/inc/threadhelp/lockhelper.hxx +++ b/framework/inc/threadhelp/lockhelper.hxx @@ -25,7 +25,7 @@ #include <threadhelp/irwlock.h> #include <threadhelp/fairrwlock.hxx> -#include <osl/mutex.hxx> +#include <comphelper/solarmutex.hxx> #include <fwidllapi.h> namespace framework{ @@ -85,7 +85,7 @@ class FWI_DLLPUBLIC LockHelper : public IMutex //------------------------------------------------------------------------------------------------------------- // ctor/dtor //------------------------------------------------------------------------------------------------------------- - LockHelper( ::osl::SolarMutex* pSolarMutex = NULL ); + LockHelper( comphelper::SolarMutex* pSolarMutex = NULL ); virtual ~LockHelper( ); //------------------------------------------------------------------------------------------------------------- @@ -106,7 +106,7 @@ class FWI_DLLPUBLIC LockHelper : public IMutex //------------------------------------------------------------------------------------------------------------- // something else //------------------------------------------------------------------------------------------------------------- - static LockHelper& getGlobalLock ( ::osl::SolarMutex* pSolarMutex = NULL ); + static LockHelper& getGlobalLock ( comphelper::SolarMutex* pSolarMutex = NULL ); ::osl::Mutex& getShareableOslMutex( ); //------------------------------------------------------------------------------------------------------------- @@ -138,7 +138,7 @@ class FWI_DLLPUBLIC LockHelper : public IMutex mutable FairRWLock* m_pFairRWLock ; mutable ::osl::Mutex* m_pOwnMutex ; - mutable ::osl::SolarMutex* m_pSolarMutex ; + mutable comphelper::SolarMutex* m_pSolarMutex ; mutable ::osl::Mutex* m_pShareableOslMutex ; mutable sal_Bool m_bDummySolarMutex ; }; diff --git a/framework/inc/threadhelp/threadhelpbase.hxx b/framework/inc/threadhelp/threadhelpbase.hxx index 042d4f6be424..b13959880a91 100644 --- a/framework/inc/threadhelp/threadhelpbase.hxx +++ b/framework/inc/threadhelp/threadhelpbase.hxx @@ -45,7 +45,7 @@ struct ThreadHelpBase // public methods //------------------------------------------------------------------------------------------------------------- public: - ThreadHelpBase( ::osl::SolarMutex* pSolarMutex = NULL ) + ThreadHelpBase( comphelper::SolarMutex* pSolarMutex = NULL ) : m_aLock( pSolarMutex ) { } diff --git a/framework/source/fwi/threadhelp/lockhelper.cxx b/framework/source/fwi/threadhelp/lockhelper.cxx index 3b4d7286b710..d32fafb170e2 100644 --- a/framework/source/fwi/threadhelp/lockhelper.cxx +++ b/framework/source/fwi/threadhelp/lockhelper.cxx @@ -44,7 +44,7 @@ namespace framework{ @onerror - *//*-*************************************************************************************************************/ -LockHelper::LockHelper( ::osl::SolarMutex* pSolarMutex ) +LockHelper::LockHelper( comphelper::SolarMutex* pSolarMutex ) : m_pFairRWLock ( NULL ) , m_pOwnMutex ( NULL ) , m_pSolarMutex ( NULL ) @@ -400,7 +400,7 @@ void LockHelper::downgradeWriteAccess() @onerror No error should occure. *//*-*************************************************************************************************************/ -LockHelper& LockHelper::getGlobalLock( ::osl::SolarMutex* pSolarMutex ) +LockHelper& LockHelper::getGlobalLock( comphelper::SolarMutex* pSolarMutex ) { // Initialize static "member" only for one time! // Algorithm: diff --git a/include/comphelper/ChainablePropertySet.hxx b/include/comphelper/ChainablePropertySet.hxx index 2dfe5f3ca256..62546c0605e5 100644 --- a/include/comphelper/ChainablePropertySet.hxx +++ b/include/comphelper/ChainablePropertySet.hxx @@ -25,6 +25,7 @@ #include <com/sun/star/beans/XMultiPropertySet.hpp> #include <comphelper/PropertyInfoHash.hxx> #include "comphelper/comphelperdllapi.h" +#include "comphelper/solarmutex.hxx" namespace comphelper { @@ -59,7 +60,7 @@ namespace comphelper friend class MasterPropertySet; protected: ChainablePropertySetInfo *mpInfo; - osl::SolarMutex* mpMutex; + SolarMutex* mpMutex; ::com::sun::star::uno::Reference < com::sun::star::beans::XPropertySetInfo > mxInfo; virtual void _preSetValues () @@ -89,7 +90,7 @@ namespace comphelper throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException ); public: - ChainablePropertySet( comphelper::ChainablePropertySetInfo* pInfo, osl::SolarMutex* pMutex = NULL ) + ChainablePropertySet( comphelper::ChainablePropertySetInfo* pInfo, SolarMutex* pMutex = NULL ) throw(); virtual ~ChainablePropertySet() throw(); diff --git a/include/comphelper/MasterPropertySet.hxx b/include/comphelper/MasterPropertySet.hxx index 266137fdb9b4..00784c4f16f2 100644 --- a/include/comphelper/MasterPropertySet.hxx +++ b/include/comphelper/MasterPropertySet.hxx @@ -24,6 +24,7 @@ #include <com/sun/star/beans/XMultiPropertySet.hpp> #include <comphelper/PropertyInfoHash.hxx> #include "comphelper/comphelperdllapi.h" +#include "comphelper/solarmutex.hxx" #include <map> namespace comphelper @@ -60,7 +61,7 @@ namespace comphelper { protected: MasterPropertySetInfo *mpInfo; - osl::SolarMutex* mpMutex; + SolarMutex* mpMutex; sal_uInt8 mnLastId; SlaveMap maSlaveMap; ::com::sun::star::uno::Reference < com::sun::star::beans::XPropertySetInfo > mxInfo; @@ -92,7 +93,7 @@ namespace comphelper throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException ); public: - MasterPropertySet( comphelper::MasterPropertySetInfo* pInfo, ::osl::SolarMutex* pMutex = NULL ) + MasterPropertySet( comphelper::MasterPropertySetInfo* pInfo, SolarMutex* pMutex = NULL ) throw(); virtual ~MasterPropertySet() throw(); diff --git a/include/comphelper/SettingsHelper.hxx b/include/comphelper/SettingsHelper.hxx index d623fa3e5494..341b7431db06 100644 --- a/include/comphelper/SettingsHelper.hxx +++ b/include/comphelper/SettingsHelper.hxx @@ -43,7 +43,7 @@ namespace comphelper public ComphelperBase { public: - SettingsHelperNoState ( ComphelperBaseInfo *pInfo, ::osl::SolarMutex* pMutex = NULL) + SettingsHelperNoState ( ComphelperBaseInfo *pInfo, SolarMutex* pMutex = NULL) : ComphelperBase ( pInfo, pMutex ) {} virtual ~SettingsHelperNoState () throw( ) {} diff --git a/include/comphelper/solarmutex.hxx b/include/comphelper/solarmutex.hxx new file mode 100644 index 000000000000..f8fce1e3a608 --- /dev/null +++ b/include/comphelper/solarmutex.hxx @@ -0,0 +1,50 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_COMPHELPER_SOLARMUTEX_HXX +#define INCLUDED_COMPHELPER_SOLARMUTEX_HXX + +#include "sal/config.h" + +#include "boost/noncopyable.hpp" +#include "comphelper/comphelperdllapi.h" + +namespace comphelper { + +/** SolarMutex interface, needed for Application::GetSolarMutex(). +*/ +class COMPHELPER_DLLPUBLIC SolarMutex: private boost::noncopyable { +public: + virtual void acquire() = 0; + + virtual void release() = 0; + + virtual bool tryToAcquire() = 0; + +protected: + SolarMutex(); + + virtual ~SolarMutex(); +}; + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/osl/mutex.hxx b/include/osl/mutex.hxx index 18ff44444223..9fab63fb27c3 100644 --- a/include/osl/mutex.hxx +++ b/include/osl/mutex.hxx @@ -238,32 +238,6 @@ namespace osl typedef Guard<Mutex> MutexGuard; typedef ClearableGuard<Mutex> ClearableMutexGuard; typedef ResettableGuard< Mutex > ResettableMutexGuard; - - /** SolarMutex interface, needed for SolarMutex. - Deprecated, used just for Application::GetSolarMutex(). - */ - class SolarMutex - { - public: - /** Blocks if mutex is already in use - */ - virtual void SAL_CALL acquire() = 0; - - /** Tries to get the mutex without blocking. - */ - virtual sal_Bool SAL_CALL tryToAcquire() = 0; - - /** Releases the mutex. - */ - virtual void SAL_CALL release() = 0; - - protected: - SolarMutex() {} - virtual ~SolarMutex() {} - }; - typedef osl::Guard< SolarMutex > SolarGuard; - typedef osl::ClearableGuard< SolarMutex > ClearableSolarGuard; - typedef osl::ResettableGuard< SolarMutex > ResettableSolarGuard; } #endif /* __cplusplus */ diff --git a/include/sfx2/docstoragemodifylistener.hxx b/include/sfx2/docstoragemodifylistener.hxx index c361b8768260..792a8dab0d97 100644 --- a/include/sfx2/docstoragemodifylistener.hxx +++ b/include/sfx2/docstoragemodifylistener.hxx @@ -26,6 +26,7 @@ #include <cppuhelper/implbase1.hxx> +namespace comphelper { class SolarMutex; } //........................................................................ namespace sfx2 @@ -55,10 +56,10 @@ namespace sfx2 class SFX2_DLLPUBLIC DocumentStorageModifyListener : public DocumentStorageModifyListener_Base { IModifiableDocument* m_pDocument; - ::osl::SolarMutex& m_rMutex; + comphelper::SolarMutex& m_rMutex; public: - DocumentStorageModifyListener( IModifiableDocument& _rDocument, ::osl::SolarMutex& _rMutex ); + DocumentStorageModifyListener( IModifiableDocument& _rDocument, comphelper::SolarMutex& _rMutex ); void dispose(); diff --git a/include/tools/solarmutex.hxx b/include/tools/solarmutex.hxx index 1d6b13c59655..cf4b156a51cf 100644 --- a/include/tools/solarmutex.hxx +++ b/include/tools/solarmutex.hxx @@ -20,14 +20,14 @@ #define _TOOLS_SOLARMUTEX_HXX #include "tools/toolsdllapi.h" -#include <osl/mutex.hxx> +#include <comphelper/solarmutex.hxx> namespace tools { class TOOLS_DLLPUBLIC SolarMutex { public: - static void SetSolarMutex( ::osl::SolarMutex* pMutex ); + static void SetSolarMutex( comphelper::SolarMutex* pMutex ); static bool Acquire(); static void Release(); }; diff --git a/include/vcl/solarmutex.hxx b/include/vcl/solarmutex.hxx index a6880a62995a..48b4f0c005ee 100644 --- a/include/vcl/solarmutex.hxx +++ b/include/vcl/solarmutex.hxx @@ -20,7 +20,8 @@ #ifndef _VCL_SOLARMUTEX_HXX_ #define _VCL_SOLARMUTEX_HXX_ -#include <osl/mutex.hxx> +#include <comphelper/solarmutex.hxx> +#include <osl/mutex.h> #include <vcl/dllapi.h> namespace vcl @@ -28,7 +29,7 @@ namespace vcl /** Implementation of the SolarMutex interface. */ -class VCL_DLLPUBLIC SolarMutexObject : public osl::SolarMutex +class VCL_DLLPUBLIC SolarMutexObject : public comphelper::SolarMutex { public: //static SolarMutex& SAL_CALL getGlobalMutex(); @@ -41,18 +42,11 @@ public: */ virtual ~SolarMutexObject(); - /** Blocks if Mutex is already in use - */ - virtual void SAL_CALL acquire(); + virtual void acquire(); - /** Tries to get the mutex without blocking. - @return True if mutex could be obtained, otherwise False - */ - virtual sal_Bool SAL_CALL tryToAcquire(); + virtual void release(); - /** Releases the mutex. - */ - virtual void SAL_CALL release(); + virtual bool tryToAcquire(); protected: oslMutex m_solarMutex; diff --git a/include/vcl/svapp.hxx b/include/vcl/svapp.hxx index f2f59c25d85b..ffe228e453d5 100644 --- a/include/vcl/svapp.hxx +++ b/include/vcl/svapp.hxx @@ -26,8 +26,8 @@ #include <stdexcept> +#include <comphelper/solarmutex.hxx> #include <osl/thread.hxx> -#include <osl/mutex.hxx> #include <tools/string.hxx> #include <tools/link.hxx> #include <tools/solar.h> @@ -165,7 +165,7 @@ public: static void Reschedule( bool bAllEvents = false ); static void Yield( bool bAllEvents = false ); static void EndYield(); - static osl::SolarMutex& GetSolarMutex(); + static comphelper::SolarMutex& GetSolarMutex(); static oslThreadIdentifier GetMainThreadIdentifier(); static sal_uLong ReleaseSolarMutex(); static void AcquireSolarMutex( sal_uLong nCount ); @@ -397,7 +397,7 @@ class VCL_DLLPUBLIC SolarMutexGuard private: SolarMutexGuard( const SolarMutexGuard& ); const SolarMutexGuard& operator = ( const SolarMutexGuard& ); - ::osl::SolarMutex& m_solarMutex; + comphelper::SolarMutex& m_solarMutex; public: @@ -450,7 +450,7 @@ public: } } protected: - osl::SolarMutex& m_solarMutex; + comphelper::SolarMutex& m_solarMutex; }; class VCL_DLLPUBLIC SolarMutexResettableGuard @@ -496,7 +496,7 @@ public: } } protected: - osl::SolarMutex& m_solarMutex; + comphelper::SolarMutex& m_solarMutex; }; diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx index 07bc970136dd..1b64286481a8 100644 --- a/sc/source/core/data/documen3.cxx +++ b/sc/source/core/data/documen3.cxx @@ -884,7 +884,7 @@ void ScDocument::RemoveUnoObject( SfxListener& rObject ) // This check is done after calling EndListening, so a later BroadcastUno call // won't touch this object. - osl::SolarMutex& rSolarMutex = Application::GetSolarMutex(); + comphelper::SolarMutex& rSolarMutex = Application::GetSolarMutex(); if ( rSolarMutex.tryToAcquire() ) { // BroadcastUno is always called with the SolarMutex locked, so if it diff --git a/sfx2/source/doc/docstoragemodifylistener.cxx b/sfx2/source/doc/docstoragemodifylistener.cxx index b3bf3b73d1f3..16a3b1c4504d 100644 --- a/sfx2/source/doc/docstoragemodifylistener.cxx +++ b/sfx2/source/doc/docstoragemodifylistener.cxx @@ -18,7 +18,7 @@ */ #include "sfx2/docstoragemodifylistener.hxx" -#include <osl/mutex.hxx> +#include <comphelper/solarmutex.hxx> //........................................................................ namespace sfx2 @@ -40,7 +40,7 @@ namespace sfx2 //= //==================================================================== //-------------------------------------------------------------------- - DocumentStorageModifyListener::DocumentStorageModifyListener( IModifiableDocument& _rDocument, ::osl::SolarMutex& _rMutex ) + DocumentStorageModifyListener::DocumentStorageModifyListener( IModifiableDocument& _rDocument, comphelper::SolarMutex& _rMutex ) :m_pDocument( &_rDocument ) ,m_rMutex( _rMutex ) { @@ -54,14 +54,14 @@ namespace sfx2 //-------------------------------------------------------------------- void DocumentStorageModifyListener::dispose() { - ::osl::SolarGuard aGuard( m_rMutex ); + ::osl::Guard< comphelper::SolarMutex > aGuard( m_rMutex ); m_pDocument = NULL; } //-------------------------------------------------------------------- void SAL_CALL DocumentStorageModifyListener::modified( const EventObject& /*aEvent*/ ) throw (RuntimeException) { - ::osl::SolarGuard aGuard( m_rMutex ); + ::osl::Guard< comphelper::SolarMutex > aGuard( m_rMutex ); // storageIsModified must not contain any locking! if ( m_pDocument ) m_pDocument->storageIsModified(); diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx index 6beaa7b279eb..78de8a7e69a4 100644 --- a/svx/source/form/fmshimp.cxx +++ b/svx/source/form/fmshimp.cxx @@ -81,9 +81,9 @@ #include <comphelper/evtmethodhelper.hxx> #include <comphelper/processfactory.hxx> #include <comphelper/property.hxx> +#include <comphelper/solarmutex.hxx> #include <comphelper/string.hxx> #include <connectivity/dbtools.hxx> -#include <osl/mutex.hxx> #include <rtl/logfile.hxx> #include <sfx2/dispatch.hxx> #include <sfx2/docfile.hxx> @@ -837,7 +837,7 @@ void SAL_CALL FmXFormShell::propertyChange(const PropertyChangeEvent& evt) throw // (Solche Paints passieren zum Beispiel, wenn man einfach nur eine andere Applikation ueber das Office legt und wieder // zurueckschaltet). // Deshalb die Benutzung des SolarMutex, der sichert das ab. - ::osl::SolarMutex& rSolarSafety = Application::GetSolarMutex(); + comphelper::SolarMutex& rSolarSafety = Application::GetSolarMutex(); if (rSolarSafety.tryToAcquire()) { m_pShell->GetViewShell()->GetViewFrame()->GetBindings().Invalidate(SID_FM_RECORD_TOTAL , sal_True, sal_False); diff --git a/sw/source/ui/inc/unodispatch.hxx b/sw/source/ui/inc/unodispatch.hxx index 2ee0e010a44d..26eb45d759b7 100644 --- a/sw/source/ui/inc/unodispatch.hxx +++ b/sw/source/ui/inc/unodispatch.hxx @@ -27,6 +27,7 @@ #include <cppuhelper/implbase2.hxx> #include <cppuhelper/implbase3.hxx> #include <list> +#include <comphelper/solarmutex.hxx> #include <osl/mutex.hxx> class SwView; @@ -41,7 +42,7 @@ class SwXDispatchProviderInterceptor : public cppu::WeakImplHelper3 class DispatchMutexLock_Impl { //::osl::MutexGuard aGuard; #102295# solar mutex has to be used currently - osl::SolarGuard aGuard; + osl::Guard< comphelper::SolarMutex > aGuard; DispatchMutexLock_Impl(); public: DispatchMutexLock_Impl(SwXDispatchProviderInterceptor&); diff --git a/tools/source/misc/solarmutex.cxx b/tools/source/misc/solarmutex.cxx index 515f0832c291..f71899901f7e 100644 --- a/tools/source/misc/solarmutex.cxx +++ b/tools/source/misc/solarmutex.cxx @@ -21,9 +21,9 @@ namespace tools { - static ::osl::SolarMutex* pSolarMutex = 0; + static comphelper::SolarMutex* pSolarMutex = 0; - void SolarMutex::SetSolarMutex( ::osl::SolarMutex* pMutex ) + void SolarMutex::SetSolarMutex( comphelper::SolarMutex* pMutex ) { pSolarMutex = pMutex; } diff --git a/vcl/aqua/source/app/salinst.cxx b/vcl/aqua/source/app/salinst.cxx index 5a3ad3304768..b97bbd555387 100644 --- a/vcl/aqua/source/app/salinst.cxx +++ b/vcl/aqua/source/app/salinst.cxx @@ -102,7 +102,7 @@ class AquaDelayedSettingsChanged : public Timer void AquaSalInstance::delayedSettingsChanged( bool bInvalidate ) { - osl::SolarGuard aGuard( *mpSalYieldMutex ); + osl::Guard< comphelper::SolarMutex > aGuard( *mpSalYieldMutex ); AquaDelayedSettingsChanged* pTimer = new AquaDelayedSettingsChanged( bInvalidate ); pTimer->SetTimeout( 50 ); pTimer->Start(); @@ -460,7 +460,7 @@ void AquaSalInstance::PostUserEvent( AquaSalFrame* pFrame, sal_uInt16 nType, voi // ----------------------------------------------------------------------- -osl::SolarMutex* AquaSalInstance::GetYieldMutex() +comphelper::SolarMutex* AquaSalInstance::GetYieldMutex() { return mpSalYieldMutex; } diff --git a/vcl/aqua/source/window/salframeview.mm b/vcl/aqua/source/window/salframeview.mm index d8ccd17e996a..2a35a4b32551 100644 --- a/vcl/aqua/source/window/salframeview.mm +++ b/vcl/aqua/source/window/salframeview.mm @@ -161,7 +161,7 @@ static AquaSalFrame* getMouseContainerFrame() { if( GetSalData() && GetSalData()->mpFirstInstance ) { - osl::SolarMutex* pMutex = GetSalData()->mpFirstInstance->GetYieldMutex(); + comphelper::SolarMutex* pMutex = GetSalData()->mpFirstInstance->GetYieldMutex(); if( pMutex ) { pMutex->acquire(); @@ -438,9 +438,9 @@ static AquaSalFrame* getMouseContainerFrame() return NO; } -// helper class similar to a osl::SolarGuard for the SalYieldMutex -// the difference is that it only does tryToAcquire instead of aquire -// so dreaded deadlocks like #i93512# are prevented +// helper class similar to a osl::Guard< comphelper::SolarMutex > for the +// SalYieldMutex; the difference is that it only does tryToAcquire instead of +// acquire so dreaded deadlocks like #i93512# are prevented class TryGuard { public: diff --git a/vcl/generic/app/geninst.cxx b/vcl/generic/app/geninst.cxx index b5d309d4f280..22a3975ab3a6 100644 --- a/vcl/generic/app/geninst.cxx +++ b/vcl/generic/app/geninst.cxx @@ -63,19 +63,19 @@ void SalYieldMutex::release() SolarMutexObject::release(); } -sal_Bool SalYieldMutex::tryToAcquire() +bool SalYieldMutex::tryToAcquire() { if ( SolarMutexObject::tryToAcquire() ) { mnThreadId = osl::Thread::getCurrentIdentifier(); mnCount++; - return sal_True; + return true; } else - return sal_False; + return false; } -osl::SolarMutex* SalGenericInstance::GetYieldMutex() +comphelper::SolarMutex* SalGenericInstance::GetYieldMutex() { return mpSalYieldMutex; } diff --git a/vcl/headless/svpinst.cxx b/vcl/headless/svpinst.cxx index 38e077760d1d..f74d37d74ab8 100644 --- a/vcl/headless/svpinst.cxx +++ b/vcl/headless/svpinst.cxx @@ -174,7 +174,7 @@ bool SvpSalInstance::CheckTimeout( bool bExecuteTimers ) m_aTimeout = aTimeOfDay; m_aTimeout += m_nTimeoutMS; - osl::SolarGuard aGuard( mpSalYieldMutex ); + osl::Guard< comphelper::SolarMutex > aGuard( mpSalYieldMutex ); // notify ImplSVData* pSVData = ImplGetSVData(); diff --git a/vcl/inc/aqua/salinst.h b/vcl/inc/aqua/salinst.h index 89469c779ae7..441cbefdab6c 100644 --- a/vcl/inc/aqua/salinst.h +++ b/vcl/inc/aqua/salinst.h @@ -20,7 +20,7 @@ #ifndef _SV_SALINST_H #define _SV_SALINST_H -#include "osl/mutex.hxx" +#include "comphelper/solarmutex.hxx" #include "osl/thread.hxx" #include "osl/conditn.h" #include <vcl/solarmutex.hxx> @@ -44,12 +44,12 @@ public: SalYieldMutex(); virtual void acquire(); virtual void release(); - virtual sal_Bool tryToAcquire(); + virtual bool tryToAcquire(); sal_uLong GetAcquireCount() const { return mnCount; } oslThreadIdentifier GetThreadId() const { return mnThreadId; } }; -#define YIELD_GUARD osl::SolarGuard aGuard( GetSalData()->mpFirstInstance->GetYieldMutex() ) +#define YIELD_GUARD osl::Guard< comphelper::SolarMutex > aGuard( GetSalData()->mpFirstInstance->GetYieldMutex() ) class AquaSalInstance : public SalInstance @@ -107,7 +107,7 @@ public: virtual SalI18NImeStatus* CreateI18NImeStatus(); virtual SalSystem* CreateSalSystem(); virtual SalBitmap* CreateSalBitmap(); - virtual osl::SolarMutex* GetYieldMutex(); + virtual comphelper::SolarMutex* GetYieldMutex(); virtual sal_uLong ReleaseYieldMutex(); virtual void AcquireYieldMutex( sal_uLong nCount ); virtual bool CheckYieldMutex(); diff --git a/vcl/inc/generic/geninst.h b/vcl/inc/generic/geninst.h index de47409e4fff..acbe1d49e2fb 100644 --- a/vcl/inc/generic/geninst.h +++ b/vcl/inc/generic/geninst.h @@ -58,7 +58,7 @@ public: virtual void acquire(); virtual void release(); - virtual sal_Bool tryToAcquire(); + virtual bool tryToAcquire(); virtual sal_uIntPtr GetAcquireCount() const { return mnCount; } oslThreadIdentifier GetThreadId() const { return mnThreadId; } @@ -81,7 +81,7 @@ public: virtual ~SalGenericInstance(); // Yield mutex - virtual osl::SolarMutex* GetYieldMutex(); + virtual comphelper::SolarMutex* GetYieldMutex(); virtual sal_uIntPtr ReleaseYieldMutex(); virtual void AcquireYieldMutex( sal_uIntPtr nCount ); virtual bool CheckYieldMutex(); diff --git a/vcl/inc/salinst.hxx b/vcl/inc/salinst.hxx index 73b79644736d..ca304cae1daa 100644 --- a/vcl/inc/salinst.hxx +++ b/vcl/inc/salinst.hxx @@ -33,7 +33,7 @@ #include <list> - +namespace comphelper { class SolarMutex; } struct SystemParentData; struct SalPrinterQueueInfo; struct ImplJobSetup; @@ -111,7 +111,7 @@ public: virtual SalBitmap* CreateSalBitmap() = 0; // YieldMutex - virtual osl::SolarMutex* + virtual comphelper::SolarMutex* GetYieldMutex() = 0; virtual sal_uLong ReleaseYieldMutex() = 0; virtual void AcquireYieldMutex( sal_uLong nCount ) = 0; diff --git a/vcl/inc/unx/gtk/gtkinst.hxx b/vcl/inc/unx/gtk/gtkinst.hxx index 6e358331e8fe..b9e510dcbf0d 100644 --- a/vcl/inc/unx/gtk/gtkinst.hxx +++ b/vcl/inc/unx/gtk/gtkinst.hxx @@ -44,7 +44,7 @@ public: GtkYieldMutex(); virtual void acquire(); virtual void release(); - virtual sal_Bool tryToAcquire() { return SalYieldMutex::tryToAcquire(); } + virtual bool tryToAcquire() { return SalYieldMutex::tryToAcquire(); } void ThreadsEnter(); void ThreadsLeave(); diff --git a/vcl/inc/win/salinst.h b/vcl/inc/win/salinst.h index 5c3b0382870c..7defd4a95fcc 100644 --- a/vcl/inc/win/salinst.h +++ b/vcl/inc/win/salinst.h @@ -59,7 +59,7 @@ public: virtual SalI18NImeStatus* CreateI18NImeStatus(); virtual SalSystem* CreateSalSystem(); virtual SalBitmap* CreateSalBitmap(); - virtual osl::SolarMutex* GetYieldMutex(); + virtual comphelper::SolarMutex* GetYieldMutex(); virtual sal_uIntPtr ReleaseYieldMutex(); virtual void AcquireYieldMutex( sal_uIntPtr nCount ); virtual bool CheckYieldMutex(); diff --git a/vcl/source/app/solarmutex.cxx b/vcl/source/app/solarmutex.cxx index 7aba45912881..fb5f416073d9 100644 --- a/vcl/source/app/solarmutex.cxx +++ b/vcl/source/app/solarmutex.cxx @@ -35,7 +35,7 @@ void SolarMutexObject::acquire() osl_acquireMutex( m_solarMutex ); } -sal_Bool SolarMutexObject::tryToAcquire() +bool SolarMutexObject::tryToAcquire() { return osl_tryToAcquireMutex( m_solarMutex ); } diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index d04d1e2baf7a..8b3d149f8714 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -63,7 +63,7 @@ #include "com/sun/star/awt/XToolkit.hpp" #include "com/sun/star/uno/XNamingService.hpp" #include "com/sun/star/lang/XMultiServiceFactory.hpp" -#include "osl/mutex.hxx" +#include "comphelper/solarmutex.hxx" #include "osl/process.h" #include <utility> @@ -473,7 +473,7 @@ void Application::Quit() // ----------------------------------------------------------------------- -osl::SolarMutex& Application::GetSolarMutex() +comphelper::SolarMutex& Application::GetSolarMutex() { ImplSVData* pSVData = ImplGetSVData(); return *(pSVData->mpDefInst->GetYieldMutex()); diff --git a/vcl/unx/generic/dtrans/X11_selection.cxx b/vcl/unx/generic/dtrans/X11_selection.cxx index 5b79345d41cd..9cd2c0be3dbc 100644 --- a/vcl/unx/generic/dtrans/X11_selection.cxx +++ b/vcl/unx/generic/dtrans/X11_selection.cxx @@ -64,7 +64,7 @@ #include <osl/process.h> #include <comphelper/processfactory.hxx> -#include <osl/mutex.hxx> +#include <comphelper/solarmutex.hxx> #define DRAG_EVENT_MASK ButtonPressMask |\ ButtonReleaseMask |\ @@ -3308,7 +3308,7 @@ void SelectionManager::startDrag( */ if( nPointerGrabSuccess != GrabSuccess ) { - osl::SolarMutex& rSolarMutex( Application::GetSolarMutex() ); + comphelper::SolarMutex& rSolarMutex( Application::GetSolarMutex() ); if( rSolarMutex.tryToAcquire() ) { pCaptureFrame = GetGenericData()->GetSalDisplay()->GetCaptureFrame(); @@ -3349,7 +3349,7 @@ void SelectionManager::startDrag( listener->dragDropEnd( aDragFailedEvent ); if( pCaptureFrame ) { - osl::SolarMutex& rSolarMutex( Application::GetSolarMutex() ); + comphelper::SolarMutex& rSolarMutex( Application::GetSolarMutex() ); if( rSolarMutex.tryToAcquire() ) GetGenericData()->GetSalDisplay()->CaptureMouse( pCaptureFrame ); #if OSL_DEBUG_LEVEL > 0 @@ -3438,7 +3438,7 @@ void SelectionManager::startDrag( if( pCaptureFrame ) { - osl::SolarMutex& rSolarMutex( Application::GetSolarMutex() ); + comphelper::SolarMutex& rSolarMutex( Application::GetSolarMutex() ); if( rSolarMutex.tryToAcquire() ) GetGenericData()->GetSalDisplay()->CaptureMouse( pCaptureFrame ); #if OSL_DEBUG_LEVEL > 0 diff --git a/vcl/unx/gtk/app/gtkdata.cxx b/vcl/unx/gtk/app/gtkdata.cxx index af7043a60556..6abb06b13205 100644 --- a/vcl/unx/gtk/app/gtkdata.cxx +++ b/vcl/unx/gtk/app/gtkdata.cxx @@ -825,7 +825,7 @@ extern "C" { SalData *pSalData = GetSalData(); - osl::SolarGuard aGuard( pSalData->m_pInstance->GetYieldMutex() ); + osl::Guard< comphelper::SolarMutex > aGuard( pSalData->m_pInstance->GetYieldMutex() ); sal_gtk_timeout_defer( pTSource ); @@ -911,7 +911,7 @@ gboolean GtkData::userEventFn( gpointer data ) gboolean bContinue = FALSE; GtkData *pThis = (GtkData *) data; SalGenericData *pData = GetGenericData(); - osl::SolarGuard aGuard( pData->m_pInstance->GetYieldMutex() ); + osl::Guard< comphelper::SolarMutex > aGuard( pData->m_pInstance->GetYieldMutex() ); const SalGenericDisplay *pDisplay = pData->GetDisplay(); if (pDisplay) { diff --git a/vcl/win/source/app/salinst.cxx b/vcl/win/source/app/salinst.cxx index ef43804c1afe..7da838c058dd 100644 --- a/vcl/win/source/app/salinst.cxx +++ b/vcl/win/source/app/salinst.cxx @@ -23,7 +23,7 @@ #include <process.h> #include <osl/file.hxx> -#include <osl/mutex.hxx> +#include <comphelper/solarmutex.hxx> #include <tools/solarmutex.hxx> @@ -107,9 +107,9 @@ public: // for ImplSalYield() public: SalYieldMutex( WinSalInstance* pInstData ); - virtual void SAL_CALL acquire(); - virtual void SAL_CALL release(); - virtual sal_Bool SAL_CALL tryToAcquire(); + virtual void acquire(); + virtual void release(); + virtual bool tryToAcquire(); sal_uLong GetAcquireCount( sal_uLong nThreadId ); }; @@ -125,7 +125,7 @@ SalYieldMutex::SalYieldMutex( WinSalInstance* pInstData ) // ----------------------------------------------------------------------- -void SAL_CALL SalYieldMutex::acquire() +void SalYieldMutex::acquire() { SolarMutexObject::acquire(); mnCount++; @@ -134,7 +134,7 @@ void SAL_CALL SalYieldMutex::acquire() // ----------------------------------------------------------------------- -void SAL_CALL SalYieldMutex::release() +void SalYieldMutex::release() { DWORD nThreadId = GetCurrentThreadId(); if ( mnThreadId != nThreadId ) @@ -176,16 +176,16 @@ void SAL_CALL SalYieldMutex::release() // ----------------------------------------------------------------------- -sal_Bool SAL_CALL SalYieldMutex::tryToAcquire() +bool SalYieldMutex::tryToAcquire() { if( SolarMutexObject::tryToAcquire() ) { mnCount++; mnThreadId = GetCurrentThreadId(); - return sal_True; + return true; } else - return sal_False; + return false; } // ----------------------------------------------------------------------- @@ -593,7 +593,7 @@ WinSalInstance::~WinSalInstance() // ----------------------------------------------------------------------- -osl::SolarMutex* WinSalInstance::GetYieldMutex() +comphelper::SolarMutex* WinSalInstance::GetYieldMutex() { return mpSalYieldMutex; } |