Kaydet (Commit) 81140558 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Use an osl::Mutex directly

Change-Id: I37264f25b5ad89f72d25f78808ff796f581536c4
üst f9c73e45
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
#ifndef INCLUDED_FRAMEWORK_INC_JOBS_CONFIGACCESS_HXX #ifndef INCLUDED_FRAMEWORK_INC_JOBS_CONFIGACCESS_HXX
#define INCLUDED_FRAMEWORK_INC_JOBS_CONFIGACCESS_HXX #define INCLUDED_FRAMEWORK_INC_JOBS_CONFIGACCESS_HXX
#include <threadhelp/threadhelpbase.hxx>
#include <general.h> #include <general.h>
#include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp>
...@@ -39,7 +38,7 @@ namespace framework{ ...@@ -39,7 +38,7 @@ namespace framework{
instead of using soecialize config items of the svtools instead of using soecialize config items of the svtools
project. This class can wrapp such configuration access. 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 ...@@ -60,6 +59,7 @@ class FWI_DLLPUBLIC ConfigAccess : public ThreadHelpBase
// member // member
private: private:
mutable osl::Mutex m_mutex;
/** /**
reference to the uno service manager reference to the uno service manager
......
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
*/ */
#include <jobs/configaccess.hxx> #include <jobs/configaccess.hxx>
#include <threadhelp/guard.hxx>
#include <general.h> #include <general.h>
#include <services.h> #include <services.h>
...@@ -47,8 +46,7 @@ namespace framework{ ...@@ -47,8 +46,7 @@ namespace framework{
*/ */
ConfigAccess::ConfigAccess( /*IN*/ const css::uno::Reference< css::uno::XComponentContext >& rxContext, ConfigAccess::ConfigAccess( /*IN*/ const css::uno::Reference< css::uno::XComponentContext >& rxContext,
/*IN*/ const OUString& sRoot ) /*IN*/ const OUString& sRoot )
: ThreadHelpBase( ) : m_xContext ( rxContext)
, m_xContext ( rxContext)
, m_sRoot ( sRoot ) , m_sRoot ( sRoot )
, m_eMode ( E_CLOSED ) , m_eMode ( E_CLOSED )
{ {
...@@ -76,10 +74,8 @@ ConfigAccess::~ConfigAccess() ...@@ -76,10 +74,8 @@ ConfigAccess::~ConfigAccess()
*/ */
ConfigAccess::EOpenMode ConfigAccess::getMode() const ConfigAccess::EOpenMode ConfigAccess::getMode() const
{ {
/* SAFE { */ osl::MutexGuard g(m_mutex);
Guard aReadLock(m_aLock);
return m_eMode; return m_eMode;
/* } SAFE */
} }
...@@ -99,10 +95,7 @@ ConfigAccess::EOpenMode ConfigAccess::getMode() const ...@@ -99,10 +95,7 @@ ConfigAccess::EOpenMode ConfigAccess::getMode() const
*/ */
void ConfigAccess::open( /*IN*/ EOpenMode eMode ) void ConfigAccess::open( /*IN*/ EOpenMode eMode )
{ {
/* SAFE { */ osl::MutexGuard g(m_mutex);
// We must lock the whole method to be shure, that nobody
// outside uses our internal member m_xAccess!
Guard aWriteLock(m_aLock);
// check if configuration is already open in the right mode. // check if configuration is already open in the right mode.
// By the way: Don't allow closing by using this method! // By the way: Don't allow closing by using this method!
...@@ -146,9 +139,6 @@ void ConfigAccess::open( /*IN*/ EOpenMode eMode ) ...@@ -146,9 +139,6 @@ void ConfigAccess::open( /*IN*/ EOpenMode eMode )
if (m_xConfig.is()) if (m_xConfig.is())
m_eMode = eMode; m_eMode = eMode;
} }
aWriteLock.unlock();
/* } SAFE */
} }
...@@ -159,11 +149,7 @@ void ConfigAccess::open( /*IN*/ EOpenMode eMode ) ...@@ -159,11 +149,7 @@ void ConfigAccess::open( /*IN*/ EOpenMode eMode )
*/ */
void ConfigAccess::close() void ConfigAccess::close()
{ {
/* SAFE { */ osl::MutexGuard g(m_mutex);
// Lock the whole method, to be shure that nobody else uses our internal members
// during this time.
Guard aWriteLock(m_aLock);
// check already closed configuration // check already closed configuration
if (m_xConfig.is()) if (m_xConfig.is())
{ {
...@@ -173,9 +159,6 @@ void ConfigAccess::close() ...@@ -173,9 +159,6 @@ void ConfigAccess::close()
m_xConfig = css::uno::Reference< css::uno::XInterface >(); m_xConfig = css::uno::Reference< css::uno::XInterface >();
m_eMode = E_CLOSED; m_eMode = E_CLOSED;
} }
aWriteLock.unlock();
/* } SAFE */
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment