From 3f47ffcf587938508ee4949ac668a76334448c71 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 23 Dec 2015 16:52:18 +0200 Subject: OModule::onFirstClient is unused also move the MutexGuard in revokeClient. No need to hold it while doing an osl_atomic_increment. Save it until we actually need to call onLastClient. Change-Id: Ia87f24b66b0430604a2fe717c95223ff1f5ece6d Reviewed-on: https://gerrit.libreoffice.org/20919 Reviewed-by: Noel Grandin Tested-by: Noel Grandin --- comphelper/source/misc/componentmodule.cxx | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'comphelper') diff --git a/comphelper/source/misc/componentmodule.cxx b/comphelper/source/misc/componentmodule.cxx index 37d5ae0c25d8..24c9a72c60a6 100644 --- a/comphelper/source/misc/componentmodule.cxx +++ b/comphelper/source/misc/componentmodule.cxx @@ -75,22 +75,17 @@ namespace comphelper void OModule::registerClient( OModule::ClientAccess ) { - ::osl::MutexGuard aGuard(m_aMutex); - if ( 1 == osl_atomic_increment( &m_nClients ) ) - onFirstClient(); + osl_atomic_increment( &m_nClients ); } void OModule::revokeClient( OModule::ClientAccess ) { - ::osl::MutexGuard aGuard(m_aMutex); if ( 0 == osl_atomic_decrement( &m_nClients ) ) + { + ::osl::MutexGuard aGuard(m_aMutex); onLastClient(); - } - - - void OModule::onFirstClient() - { + } } -- cgit v1.2.3