From 8114055880ef14999058cd549dd7bda83cbf1c69 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Thu, 20 Mar 2014 11:49:25 +0100 Subject: Use an osl::Mutex directly Change-Id: I37264f25b5ad89f72d25f78808ff796f581536c4 --- framework/inc/jobs/configaccess.hxx | 4 ++-- framework/source/fwi/jobs/configaccess.cxx | 25 ++++--------------------- 2 files changed, 6 insertions(+), 23 deletions(-) (limited to 'framework') diff --git a/framework/inc/jobs/configaccess.hxx b/framework/inc/jobs/configaccess.hxx index de0ee8a6d774..be5b464b6257 100644 --- a/framework/inc/jobs/configaccess.hxx +++ b/framework/inc/jobs/configaccess.hxx @@ -20,7 +20,6 @@ #ifndef INCLUDED_FRAMEWORK_INC_JOBS_CONFIGACCESS_HXX #define INCLUDED_FRAMEWORK_INC_JOBS_CONFIGACCESS_HXX -#include #include #include @@ -39,7 +38,7 @@ namespace framework{ instead of using soecialize config items of the svtools project. This class can wrapp such configuration access. */ -class FWI_DLLPUBLIC ConfigAccess : public ThreadHelpBase +class FWI_DLLPUBLIC ConfigAccess { @@ -60,6 +59,7 @@ class FWI_DLLPUBLIC ConfigAccess : public ThreadHelpBase // member private: + mutable osl::Mutex m_mutex; /** reference to the uno service manager diff --git a/framework/source/fwi/jobs/configaccess.cxx b/framework/source/fwi/jobs/configaccess.cxx index f83d42916fcc..fb88bff4bc89 100644 --- a/framework/source/fwi/jobs/configaccess.cxx +++ b/framework/source/fwi/jobs/configaccess.cxx @@ -18,7 +18,6 @@ */ #include -#include #include #include @@ -47,8 +46,7 @@ namespace framework{ */ ConfigAccess::ConfigAccess( /*IN*/ const css::uno::Reference< css::uno::XComponentContext >& rxContext, /*IN*/ const OUString& sRoot ) - : ThreadHelpBase( ) - , m_xContext ( rxContext) + : m_xContext ( rxContext) , m_sRoot ( sRoot ) , m_eMode ( E_CLOSED ) { @@ -76,10 +74,8 @@ ConfigAccess::~ConfigAccess() */ ConfigAccess::EOpenMode ConfigAccess::getMode() const { - /* SAFE { */ - Guard aReadLock(m_aLock); + osl::MutexGuard g(m_mutex); return m_eMode; - /* } SAFE */ } @@ -99,10 +95,7 @@ ConfigAccess::EOpenMode ConfigAccess::getMode() const */ void ConfigAccess::open( /*IN*/ EOpenMode eMode ) { - /* SAFE { */ - // We must lock the whole method to be shure, that nobody - // outside uses our internal member m_xAccess! - Guard aWriteLock(m_aLock); + osl::MutexGuard g(m_mutex); // check if configuration is already open in the right mode. // By the way: Don't allow closing by using this method! @@ -146,9 +139,6 @@ void ConfigAccess::open( /*IN*/ EOpenMode eMode ) if (m_xConfig.is()) m_eMode = eMode; } - - aWriteLock.unlock(); - /* } SAFE */ } @@ -159,11 +149,7 @@ void ConfigAccess::open( /*IN*/ EOpenMode eMode ) */ void ConfigAccess::close() { - /* SAFE { */ - // Lock the whole method, to be shure that nobody else uses our internal members - // during this time. - Guard aWriteLock(m_aLock); - + osl::MutexGuard g(m_mutex); // check already closed configuration if (m_xConfig.is()) { @@ -173,9 +159,6 @@ void ConfigAccess::close() m_xConfig = css::uno::Reference< css::uno::XInterface >(); m_eMode = E_CLOSED; } - - aWriteLock.unlock(); - /* } SAFE */ } -- cgit