diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2014-03-20 11:49:25 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2014-03-20 15:04:13 +0100 |
commit | 8114055880ef14999058cd549dd7bda83cbf1c69 (patch) | |
tree | ca7d46481fa093f8b2de7713018b7e221a9424a5 /framework | |
parent | f9c73e458f0be91f0034f98b3876cfbd4233371b (diff) |
Use an osl::Mutex directly
Change-Id: I37264f25b5ad89f72d25f78808ff796f581536c4
Diffstat (limited to 'framework')
-rw-r--r-- | framework/inc/jobs/configaccess.hxx | 4 | ||||
-rw-r--r-- | framework/source/fwi/jobs/configaccess.cxx | 25 |
2 files changed, 6 insertions, 23 deletions
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 <threadhelp/threadhelpbase.hxx> #include <general.h> #include <com/sun/star/lang/XMultiServiceFactory.hpp> @@ -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 <jobs/configaccess.hxx> -#include <threadhelp/guard.hxx> #include <general.h> #include <services.h> @@ -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 */ } |