summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2014-03-20 16:43:22 +0100
committerStephan Bergmann <sbergman@redhat.com>2014-03-20 17:30:03 +0100
commitc8239a1dd46c78f89fa31599036300ecf60108b5 (patch)
treeaab0eb3b038ae1ff938b9b3fbf8cfdcbe61cbe24 /framework
parent250a4e8875d97a75683349415502a345f03138a0 (diff)
Remove newly unused framework::LockHelper class
...and make LockHelper::getGlobalLock() FWI_DLLPUBLIC again (so there's a single such lock, not one per library). Change-Id: I0aed77333dc93cdf1c7dd7b96620fb7a8eb3dd64
Diffstat (limited to 'framework')
-rw-r--r--framework/inc/threadhelp/lockhelper.hxx62
-rw-r--r--framework/source/fwe/classes/actiontriggerpropertyset.cxx8
-rw-r--r--framework/source/fwe/classes/actiontriggerseparatorpropertyset.cxx8
-rw-r--r--framework/source/fwi/classes/protocolhandlercache.cxx8
-rw-r--r--framework/source/fwi/threadhelp/lockhelper.cxx133
-rw-r--r--framework/source/helper/statusindicatorfactory.cxx2
-rw-r--r--framework/source/services/desktop.cxx4
-rw-r--r--framework/source/services/frame.cxx4
8 files changed, 32 insertions, 197 deletions
diff --git a/framework/inc/threadhelp/lockhelper.hxx b/framework/inc/threadhelp/lockhelper.hxx
index 248fcac94df7..eb2260a6378a 100644
--- a/framework/inc/threadhelp/lockhelper.hxx
+++ b/framework/inc/threadhelp/lockhelper.hxx
@@ -20,68 +20,20 @@
#ifndef INCLUDED_FRAMEWORK_INC_THREADHELP_LOCKHELPER_HXX
#define INCLUDED_FRAMEWORK_INC_THREADHELP_LOCKHELPER_HXX
-#include <boost/noncopyable.hpp>
-#include <osl/mutex.hxx>
-#include <rtl/instance.hxx>
+#include <sal/config.h>
-#include <comphelper/solarmutex.hxx>
#include <fwidllapi.h>
-namespace framework{
+namespace osl { class Mutex; }
+
+namespace framework { namespace LockHelper {
//TODO: This presumable should return the SolarMutex, though it actually returns
// some independent mutex:
-struct GlobalLock: public rtl::Static<osl::Mutex, GlobalLock> {};
-
-/*-************************************************************************************************************
- @short helper to set right lock in right situation
- @descr This helper support different types of locking:
- a) no locks - transparent for user!
- This could be useful for simluation or single threaded environments!
- b) own mutex
- An object use his own osl-mutex to be threadsafe. Useful for easy and exclusiv locking.
- c) solar mutex
- An object use our solar mutex and will be a part of a greater safed "threadsafe code block".
- Could be useful for simulation and testing of higher modules!
- d) fair rw-lock
- An object use an implementation of a fair rw-lock. This increase granularity of t hreadsafe mechanism
- and should be used for high performance threadsafe code!
-
- @devstatus draft
-*//*-*************************************************************************************************************/
-class FWI_DLLPUBLIC LockHelper : private boost::noncopyable
-{
-
- // public methods
-
- public:
-
-
- // ctor/dtor
-
- LockHelper( comphelper::SolarMutex* pSolarMutex = NULL );
- ~LockHelper( );
-
- void acquire();
- void release();
-
- // something else
-
- ::osl::Mutex& getShareableOslMutex( );
-
-
- // private member
- // Make some member mutable for using in const functions!
-
- private:
-
- mutable comphelper::SolarMutex* m_pSolarMutex ;
- mutable ::osl::Mutex* m_pShareableOslMutex ;
- mutable sal_Bool m_bDummySolarMutex ;
-};
+FWI_DLLPUBLIC osl::Mutex & getGlobalLock();
-} // namespace framework
+} }
-#endif // INCLUDED_FRAMEWORK_INC_THREADHELP_LOCKHELPER_HXX
+#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/framework/source/fwe/classes/actiontriggerpropertyset.cxx b/framework/source/fwe/classes/actiontriggerpropertyset.cxx
index 8fdfed67e980..402d277ae0f2 100644
--- a/framework/source/fwe/classes/actiontriggerpropertyset.cxx
+++ b/framework/source/fwe/classes/actiontriggerpropertyset.cxx
@@ -201,7 +201,7 @@ void SAL_CALL ActionTriggerPropertySet::setFastPropertyValue_NoBroadcast(
sal_Int32 nHandle, const Any& aValue )
throw( Exception, std::exception )
{
- ::osl::MutexGuard aGuard( GlobalLock::get() );
+ ::osl::MutexGuard aGuard( LockHelper::getGlobalLock() );
// Search for right handle ... and try to set property value.
switch( nHandle )
@@ -231,7 +231,7 @@ throw( Exception, std::exception )
void SAL_CALL ActionTriggerPropertySet::getFastPropertyValue(
Any& aValue, sal_Int32 nHandle ) const
{
- ::osl::MutexGuard aGuard( GlobalLock::get() );
+ ::osl::MutexGuard aGuard( LockHelper::getGlobalLock() );
// Search for right handle ... and try to get property value.
switch( nHandle )
@@ -268,7 +268,7 @@ void SAL_CALL ActionTriggerPropertySet::getFastPropertyValue(
if( pInfoHelper == NULL )
{
// Ready for multithreading
- ::osl::MutexGuard aGuard( GlobalLock::get() );
+ ::osl::MutexGuard aGuard( LockHelper::getGlobalLock() );
// Control this pointer again, another instance can be faster then these!
if( pInfoHelper == NULL )
{
@@ -294,7 +294,7 @@ throw ( RuntimeException, std::exception )
if( pInfo == NULL )
{
// Ready for multithreading
- ::osl::MutexGuard aGuard( GlobalLock::get() );
+ ::osl::MutexGuard aGuard( LockHelper::getGlobalLock() );
// Control this pointer again, another instance can be faster then these!
if( pInfo == NULL )
{
diff --git a/framework/source/fwe/classes/actiontriggerseparatorpropertyset.cxx b/framework/source/fwe/classes/actiontriggerseparatorpropertyset.cxx
index 6fc046f39e27..d9e3a1aa6598 100644
--- a/framework/source/fwe/classes/actiontriggerseparatorpropertyset.cxx
+++ b/framework/source/fwe/classes/actiontriggerseparatorpropertyset.cxx
@@ -178,7 +178,7 @@ void SAL_CALL ActionTriggerSeparatorPropertySet::setFastPropertyValue_NoBroadcas
sal_Int32 nHandle, const Any& aValue )
throw( Exception, std::exception )
{
- ::osl::MutexGuard aGuard( GlobalLock::get() );
+ ::osl::MutexGuard aGuard( LockHelper::getGlobalLock() );
// Search for right handle ... and try to set property value.
switch( nHandle )
@@ -192,7 +192,7 @@ throw( Exception, std::exception )
void SAL_CALL ActionTriggerSeparatorPropertySet::getFastPropertyValue(
Any& aValue, sal_Int32 nHandle ) const
{
- ::osl::MutexGuard aGuard( GlobalLock::get() );
+ ::osl::MutexGuard aGuard( LockHelper::getGlobalLock() );
// Search for right handle ... and try to get property value.
switch( nHandle )
@@ -213,7 +213,7 @@ void SAL_CALL ActionTriggerSeparatorPropertySet::getFastPropertyValue(
if( pInfoHelper == NULL )
{
// Ready for multithreading
- ::osl::MutexGuard aGuard( GlobalLock::get() );
+ ::osl::MutexGuard aGuard( LockHelper::getGlobalLock() );
// Control this pointer again, another instance can be faster then these!
if( pInfoHelper == NULL )
{
@@ -239,7 +239,7 @@ throw ( RuntimeException, std::exception )
if( pInfo == NULL )
{
// Ready for multithreading
- ::osl::MutexGuard aGuard( GlobalLock::get() );
+ ::osl::MutexGuard aGuard( LockHelper::getGlobalLock() );
// Control this pointer again, another instance can be faster then these!
if( pInfo == NULL )
{
diff --git a/framework/source/fwi/classes/protocolhandlercache.cxx b/framework/source/fwi/classes/protocolhandlercache.cxx
index c90a5c0c4000..64ecf8bd8490 100644
--- a/framework/source/fwi/classes/protocolhandlercache.cxx
+++ b/framework/source/fwi/classes/protocolhandlercache.cxx
@@ -80,7 +80,7 @@ HandlerCFGAccess* HandlerCache::m_pConfig = NULL;
*/
HandlerCache::HandlerCache()
{
- osl::MutexGuard g(GlobalLock::get());
+ osl::MutexGuard g(LockHelper::getGlobalLock());
if (m_nRefCount==0)
{
@@ -101,7 +101,7 @@ HandlerCache::HandlerCache()
*/
HandlerCache::~HandlerCache()
{
- osl::MutexGuard g(GlobalLock::get());
+ osl::MutexGuard g(LockHelper::getGlobalLock());
if( m_nRefCount==1)
{
@@ -129,7 +129,7 @@ sal_Bool HandlerCache::search( const OUString& sURL, ProtocolHandler* pReturn )
{
sal_Bool bFound = sal_False;
/* SAFE */{
- osl::MutexGuard g(GlobalLock::get());
+ osl::MutexGuard g(LockHelper::getGlobalLock());
PatternHash::const_iterator pItem = m_pPattern->findPatternKey(sURL);
if (pItem!=m_pPattern->end())
{
@@ -153,7 +153,7 @@ sal_Bool HandlerCache::search( const css::util::URL& aURL, ProtocolHandler* pRet
void HandlerCache::takeOver(HandlerHash* pHandler, PatternHash* pPattern)
{
- osl::MutexGuard g(GlobalLock::get());
+ osl::MutexGuard g(LockHelper::getGlobalLock());
HandlerHash* pOldHandler = m_pHandler;
PatternHash* pOldPattern = m_pPattern;
diff --git a/framework/source/fwi/threadhelp/lockhelper.cxx b/framework/source/fwi/threadhelp/lockhelper.cxx
index 856344342a6e..89a4a75df64d 100644
--- a/framework/source/fwi/threadhelp/lockhelper.cxx
+++ b/framework/source/fwi/threadhelp/lockhelper.cxx
@@ -17,138 +17,21 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include <threadhelp/lockhelper.hxx>
-#include <general.h>
-
-#include <macros/generic.hxx>
-#include "vcl/solarmutex.hxx"
-
-#include <osl/process.h>
-
-namespace framework{
-
-/*-************************************************************************************************************
- @short use ctor to initialize instance
-
- @seealso class Guard
+#include <sal/config.h>
- @param "rSolarMutex", for some components we must be "vcl-free"! So we can't work with our solar mutex
- directly. User must set his reference at this instance - so we can work with it!
- @return -
+#include <osl/mutex.hxx>
+#include <rtl/instance.hxx>
- @onerror -
-*//*-*************************************************************************************************************/
-LockHelper::LockHelper( comphelper::SolarMutex* pSolarMutex )
- : m_pSolarMutex ( NULL )
- , m_pShareableOslMutex( NULL )
- , m_bDummySolarMutex ( sal_False )
-{
- if( pSolarMutex == NULL )
- {
- m_pSolarMutex = new ::vcl::SolarMutexObject;
- m_bDummySolarMutex = sal_True;
- }
- else
- {
- m_pSolarMutex = pSolarMutex;
- }
-}
-
-/*-************************************************************************************************************
- @short default dtor to release safed pointer
- @descr We have created dynamical mutex- or lock-member ... or we hold a pointer to external objects.
- We must release it!
-
- @seealso ctor()
-
- @param -
- @return -
-
- @onerror -
-*//*-*************************************************************************************************************/
-LockHelper::~LockHelper()
-{
- if( m_pShareableOslMutex != NULL )
- {
- delete m_pShareableOslMutex;
- m_pShareableOslMutex = NULL;
- }
- if( m_pSolarMutex != NULL )
- {
- if (m_bDummySolarMutex)
- {
- delete static_cast<vcl::SolarMutexObject*>(m_pSolarMutex);
- m_bDummySolarMutex = sal_False;
- }
- m_pSolarMutex = NULL;
- }
-}
-
-/*-************************************************************************************************************
- @short set an exclusiv lock
- @descr We must match this lock call with current set lock type and used lock member.
- If a mutex should be used - it will be easy ... but if a rw-lock should be used
- we must simulate it as a write access!
-
- @attention If a shareable osl mutex exist, he must be used as twice!
- It's necessary for some cppu-helper classes ...
-
- @param -
- @return -
-
- @onerror -
-*//*-*************************************************************************************************************/
-void LockHelper::acquire()
-{
- m_pSolarMutex->acquire();
-}
-
-/*-************************************************************************************************************
- @short release exclusiv lock
- @descr We must match this unlock call with current set lock type and used lock member.
- If a mutex should be used - it will be easy ... but if a rw-lock should be used
- we must simulate it as a write access!
+#include <threadhelp/lockhelper.hxx>
- @attention If a shareable osl mutex exist, he must be used as twice!
- It's necessary for some cppu-helper classes ...
+namespace {
- @param -
- @return -
+struct GlobalLock: public rtl::Static<osl::Mutex, GlobalLock> {};
- @onerror -
-*//*-*************************************************************************************************************/
-void LockHelper::release()
-{
- m_pSolarMutex->release();
}
-/*-************************************************************************************************************
- @short return a reference to shared mutex member
- @descr Sometimes we need a osl-mutex for sharing with our uno helper ...
- What can we do?
- We must use a different mutex member :-(
- I HOPE IT WORKS!
-
- @seealso -
-
- @param -
- @return A reference to a shared mutex.
-
- @onerror No error should occur.
-*//*-*************************************************************************************************************/
-::osl::Mutex& LockHelper::getShareableOslMutex()
-{
- if( m_pShareableOslMutex == NULL )
- {
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if( m_pShareableOslMutex == NULL )
- {
- m_pShareableOslMutex = new ::osl::Mutex;
- }
- }
- return *m_pShareableOslMutex;
+osl::Mutex & framework::LockHelper::getGlobalLock() {
+ return GlobalLock::get();
}
-} // namespace framework
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/framework/source/helper/statusindicatorfactory.cxx b/framework/source/helper/statusindicatorfactory.cxx
index 85a56b8355ad..ef05159898f9 100644
--- a/framework/source/helper/statusindicatorfactory.cxx
+++ b/framework/source/helper/statusindicatorfactory.cxx
@@ -531,7 +531,7 @@ void StatusIndicatorFactory::impl_reschedule(sal_Bool bForce)
return;
// SAFE ->
- osl::ResettableMutexGuard aGlobalLock(GlobalLock::get());
+ osl::ResettableMutexGuard aGlobalLock(LockHelper::getGlobalLock());
if (m_nInReschedule == 0)
{
diff --git a/framework/source/services/desktop.cxx b/framework/source/services/desktop.cxx
index 44c24ab20fcb..4a8cec367202 100644
--- a/framework/source/services/desktop.cxx
+++ b/framework/source/services/desktop.cxx
@@ -1533,7 +1533,7 @@ void SAL_CALL Desktop::getFastPropertyValue( css::uno::Any& aValue ,
if( pInfoHelper == NULL )
{
// Ready for multithreading
- ::osl::MutexGuard aGuard( GlobalLock::get() );
+ ::osl::MutexGuard aGuard( LockHelper::getGlobalLock() );
// Control this pointer again, another instance can be faster then these!
if( pInfoHelper == NULL )
{
@@ -1581,7 +1581,7 @@ css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL Desktop::getPropert
if( pInfo == NULL )
{
// Ready for multithreading
- ::osl::MutexGuard aGuard( GlobalLock::get() );
+ ::osl::MutexGuard aGuard( LockHelper::getGlobalLock() );
// Control this pointer again, another instance can be faster then these!
if( pInfo == NULL )
{
diff --git a/framework/source/services/frame.cxx b/framework/source/services/frame.cxx
index 521e3e756693..583e8d5f1a9a 100644
--- a/framework/source/services/frame.cxx
+++ b/framework/source/services/frame.cxx
@@ -2700,7 +2700,7 @@ void SAL_CALL Frame::windowShown( const css::lang::EventObject& ) throw(css::uno
if (xDesktopCheck.is())
{
/* STATIC SAFE { */
- osl::ClearableMutexGuard aStaticWriteLock( GlobalLock::get() );
+ osl::ClearableMutexGuard aStaticWriteLock( LockHelper::getGlobalLock() );
sal_Bool bMustBeTriggered = bFirstVisibleTask;
bFirstVisibleTask = sal_False;
aStaticWriteLock.clear();
@@ -3443,7 +3443,7 @@ void Frame::impl_checkMenuCloser()
// Look for necessary actions ...
// Only if the closer state must be moved from one frame to another one
// or must be enabled/disabled at all.
- osl::MutexGuard g(GlobalLock::get());
+ osl::MutexGuard g(LockHelper::getGlobalLock());
css::uno::Reference< css::frame::XFrame2 > xCloserFrame (m_xCloserFrame.get(), css::uno::UNO_QUERY);
if (xCloserFrame!=xNewCloserFrame)
{