diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-04-07 15:12:52 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-04-10 08:52:36 +0200 |
commit | 2841cf6c9f733c2c26e90b8494b5b076cc9d507d (patch) | |
tree | 71eca2a1f47f9860aa0ad9f34898e227d258eb1a /unotools | |
parent | 52117bb8c337c98c200b6846c8d9fa2d1831ac51 (diff) |
loplugin:inlinefields in utl::ReadWriteMutex
Change-Id: Ibd31d1c0ec154be886f9fd4d2e7a439b2d7f5f4a
Reviewed-on: https://gerrit.libreoffice.org/36267
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'unotools')
-rw-r--r-- | unotools/source/i18n/readwritemutexguard.cxx | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/unotools/source/i18n/readwritemutexguard.cxx b/unotools/source/i18n/readwritemutexguard.cxx index 904dba39c0c7..2932212d3c12 100644 --- a/unotools/source/i18n/readwritemutexguard.cxx +++ b/unotools/source/i18n/readwritemutexguard.cxx @@ -28,52 +28,52 @@ ReadWriteGuard::ReadWriteGuard( ReadWriteMutex& rMutexP, { // don't do anything until a pending write completed (or another // ReadWriteGuard leaves the ctor phase) - ::osl::MutexGuard aGuard( rMutex.pWriteMutex ); + ::osl::MutexGuard aGuard( rMutex.maWriteMutex ); nMode = nRequestMode; if ( nMode & ReadWriteGuardMode::nWrite ) { - rMutex.pWriteMutex->acquire(); + rMutex.maWriteMutex.acquire(); // wait for any read to complete // TODO: set up a waiting thread instead of a loop bool bWait = true; do { - rMutex.pMutex->acquire(); + rMutex.maMutex.acquire(); bWait = (rMutex.nReadCount != 0); if ( nMode & ReadWriteGuardMode::nCriticalChange ) bWait |= (rMutex.nBlockCriticalCount != 0); - rMutex.pMutex->release(); + rMutex.maMutex.release(); } while ( bWait ); } else if ( nMode & ReadWriteGuardMode::nBlockCritical ) { - rMutex.pMutex->acquire(); + rMutex.maMutex.acquire(); ++rMutex.nBlockCriticalCount; - rMutex.pMutex->release(); + rMutex.maMutex.release(); } else { - rMutex.pMutex->acquire(); + rMutex.maMutex.acquire(); ++rMutex.nReadCount; - rMutex.pMutex->release(); + rMutex.maMutex.release(); } } ReadWriteGuard::~ReadWriteGuard() { if ( nMode & ReadWriteGuardMode::nWrite ) - rMutex.pWriteMutex->release(); + rMutex.maWriteMutex.release(); else if ( nMode & ReadWriteGuardMode::nBlockCritical ) { - rMutex.pMutex->acquire(); + rMutex.maMutex.acquire(); --rMutex.nBlockCriticalCount; - rMutex.pMutex->release(); + rMutex.maMutex.release(); } else { - rMutex.pMutex->acquire(); + rMutex.maMutex.acquire(); --rMutex.nReadCount; - rMutex.pMutex->release(); + rMutex.maMutex.release(); } } @@ -86,20 +86,20 @@ void ReadWriteGuard::changeReadToWrite() // MUST release read before acquiring write mutex or dead lock would // occur if there was a write in another thread waiting for this read // to complete. - rMutex.pMutex->acquire(); + rMutex.maMutex.acquire(); --rMutex.nReadCount; - rMutex.pMutex->release(); + rMutex.maMutex.release(); - rMutex.pWriteMutex->acquire(); + rMutex.maWriteMutex.acquire(); nMode |= ReadWriteGuardMode::nWrite; // wait for any other read to complete // TODO: set up a waiting thread instead of a loop bool bWait = true; do { - rMutex.pMutex->acquire(); + rMutex.maMutex.acquire(); bWait = (rMutex.nReadCount != 0); - rMutex.pMutex->release(); + rMutex.maMutex.release(); } while ( bWait ); } } |