summaryrefslogtreecommitdiff
path: root/comphelper
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-06-20 11:13:44 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-06-21 08:19:49 +0200
commit4c93de2c921b43193985c057b03e329d6dddc5d4 (patch)
tree3deccb18a9ebc941f7dcd3ff14780b8dcd9951f2 /comphelper
parentec665e3e898e733c9f602b21046079e569b58568 (diff)
merge GenericSolarMutex and SolarMutex
Since nothing else is implementing the SolarMutex abstract class. Change-Id: I2a41254af3e9c7534033cdd0bece9dd8e0258b9d Reviewed-on: https://gerrit.libreoffice.org/56153 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'comphelper')
-rw-r--r--comphelper/source/misc/solarmutex.cxx31
1 files changed, 11 insertions, 20 deletions
diff --git a/comphelper/source/misc/solarmutex.cxx b/comphelper/source/misc/solarmutex.cxx
index 1501228b1bc6..3af24dadb4c7 100644
--- a/comphelper/source/misc/solarmutex.cxx
+++ b/comphelper/source/misc/solarmutex.cxx
@@ -26,39 +26,30 @@
namespace comphelper {
-SolarMutex::SolarMutex() {}
-
-SolarMutex::~SolarMutex() {}
-
namespace {
- static SolarMutex* pSolarMutex = nullptr;
-}
-
-void SolarMutex::setSolarMutex( SolarMutex *pMutex )
-{
- assert((pMutex && !pSolarMutex) || !pMutex);
- pSolarMutex = pMutex;
+ static SolarMutex* g_pSolarMutex = nullptr;
}
SolarMutex *SolarMutex::get()
{
- return pSolarMutex;
+ return g_pSolarMutex;
}
-GenericSolarMutex::GenericSolarMutex()
+SolarMutex::SolarMutex()
: m_nCount( 0 )
, m_nThreadId( 0 )
, m_aBeforeReleaseHandler( nullptr )
{
- setSolarMutex( this );
+ assert(!g_pSolarMutex);
+ g_pSolarMutex = this;
}
-GenericSolarMutex::~GenericSolarMutex()
+SolarMutex::~SolarMutex()
{
- setSolarMutex( nullptr );
+ g_pSolarMutex = nullptr;
}
-void GenericSolarMutex::doAcquire( const sal_uInt32 nLockCount )
+void SolarMutex::doAcquire( const sal_uInt32 nLockCount )
{
for ( sal_uInt32 n = nLockCount; n ; --n )
m_aMutex.acquire();
@@ -66,7 +57,7 @@ void GenericSolarMutex::doAcquire( const sal_uInt32 nLockCount )
m_nCount += nLockCount;
}
-sal_uInt32 GenericSolarMutex::doRelease( bool bUnlockAll )
+sal_uInt32 SolarMutex::doRelease( bool bUnlockAll )
{
if ( m_nCount == 0 )
std::abort();
@@ -89,12 +80,12 @@ sal_uInt32 GenericSolarMutex::doRelease( bool bUnlockAll )
return nCount;
}
-bool GenericSolarMutex::IsCurrentThread() const
+bool SolarMutex::IsCurrentThread() const
{
return m_nThreadId == osl::Thread::getCurrentIdentifier();
}
-bool GenericSolarMutex::tryToAcquire()
+bool SolarMutex::tryToAcquire()
{
if ( m_aMutex.tryToAcquire() )
{