diff options
author | Jan-Marek Glogowski <glogow@fbihome.de> | 2017-08-15 08:05:51 +0200 |
---|---|---|
committer | Jan-Marek Glogowski <glogow@fbihome.de> | 2017-09-19 09:25:14 +0200 |
commit | 3840aede596e6fc24f7ed7df9100fb028134aac6 (patch) | |
tree | 74d1d5efa3b2ad5448181fc185faf226aed192e4 /vcl/inc/osx | |
parent | 10b49dfb3996f99dec8dd0d2ffae2aef4022f395 (diff) |
Unify SolarMutex implementations
All backends implement the SolarMutex in mostly the same way.
So this consolidates this code into a GenericSolarMutex.
We still need the abstract SolarMutex class for the fake AKA
fascade implementation in dbaccess.
The patch also replaces various places of direct mutex usage with
either SolarMutexGuard or SolarMutexReleaser objects.
Change-Id: Ia0146dd6c51a3b9a513cc6af34a66def58aad831
Reviewed-on: https://gerrit.libreoffice.org/42325
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
Diffstat (limited to 'vcl/inc/osx')
-rw-r--r-- | vcl/inc/osx/salinst.h | 30 |
1 files changed, 8 insertions, 22 deletions
diff --git a/vcl/inc/osx/salinst.h b/vcl/inc/osx/salinst.h index bd02608d4d45..263b9027b956 100644 --- a/vcl/inc/osx/salinst.h +++ b/vcl/inc/osx/salinst.h @@ -37,19 +37,15 @@ class ApplicationEvent; class Image; enum class SalEvent; -class SalYieldMutex : public comphelper::SolarMutex +class SalYieldMutex : public comphelper::GenericSolarMutex { - osl::Mutex m_mutex; - sal_uLong mnCount; - oslThreadIdentifier mnThreadId; +protected: + virtual void doAcquire( sal_uInt32 nLockCount ) override; + virtual sal_uInt32 doRelease( bool bUnlockAll ) override; public: - SalYieldMutex(); - virtual void acquire() override; - virtual void release() override; - virtual bool tryToAcquire() override; - sal_uLong GetAcquireCount() const { return mnCount; } - oslThreadIdentifier GetThreadId() const { return mnThreadId; } + SalYieldMutex(); + virtual ~SalYieldMutex(); }; class AquaSalInstance : public SalInstance @@ -105,9 +101,8 @@ public: virtual SalSystem* CreateSalSystem() override; virtual SalBitmap* CreateSalBitmap() override; virtual comphelper::SolarMutex* GetYieldMutex() override; - virtual sal_uLong ReleaseYieldMutex() override; - virtual void AcquireYieldMutex( sal_uLong nCount ) override; - virtual bool CheckYieldMutex() override; + virtual sal_uInt32 ReleaseYieldMutex( bool bUnlockAll = false ) override; + virtual void AcquireYieldMutex( sal_uInt32 nCount = 1 ) override; virtual bool DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLong nReleased) override; virtual bool AnyInput( VclInputFlags nType ) override; @@ -159,15 +154,6 @@ public: static NSMenu* GetDynamicDockMenu(); }; -// helper class: inverted solar guard -class YieldMutexReleaser -{ - sal_uLong mnCount; - public: - YieldMutexReleaser(); - ~YieldMutexReleaser(); -}; - CGImageRef CreateCGImage( const Image& ); NSImage* CreateNSImage( const Image& ); |