framework/inc/jobs/configaccess.hxx | 5 +++-- framework/source/fwi/jobs/configaccess.cxx | 13 +++++++++---- framework/source/helper/statusindicatorfactory.cxx | 10 +++++----- 3 files changed, 17 insertions(+), 11 deletions(-)
New commits: commit efd95650cba2460bc153de00f8eb27785ad0e18a Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Sun Nov 21 11:53:36 2021 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Sun Nov 21 15:47:17 2021 +0100 osl::Mutex->std::mutex in framework::ConfigAccess Change-Id: I44d41db2498ea39fca309785278c1fe50d7ae8b9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125617 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/framework/inc/jobs/configaccess.hxx b/framework/inc/jobs/configaccess.hxx index 4d73df2e1c46..19d9265f952a 100644 --- a/framework/inc/jobs/configaccess.hxx +++ b/framework/inc/jobs/configaccess.hxx @@ -20,8 +20,8 @@ #pragma once #include <com/sun/star/uno/XComponentContext.hpp> - #include <rtl/ustring.hxx> +#include <mutex> namespace framework{ @@ -50,7 +50,7 @@ class ConfigAccess final // member private: - mutable osl::Mutex m_mutex; + mutable std::mutex m_mutex; /** reference to the uno service manager @@ -69,6 +69,7 @@ class ConfigAccess final // native interface methods + void closeImpl(); public: ConfigAccess( const css::uno::Reference< css::uno::XComponentContext >& rxContext, diff --git a/framework/source/fwi/jobs/configaccess.cxx b/framework/source/fwi/jobs/configaccess.cxx index d3ce0e5f70a1..27f2c3dd9572 100644 --- a/framework/source/fwi/jobs/configaccess.cxx +++ b/framework/source/fwi/jobs/configaccess.cxx @@ -67,7 +67,7 @@ ConfigAccess::~ConfigAccess() */ ConfigAccess::EOpenMode ConfigAccess::getMode() const { - osl::MutexGuard g(m_mutex); + std::unique_lock g(m_mutex); return m_eMode; } @@ -87,7 +87,7 @@ ConfigAccess::EOpenMode ConfigAccess::getMode() const */ void ConfigAccess::open( /*IN*/ EOpenMode eMode ) { - osl::MutexGuard g(m_mutex); + std::unique_lock g(m_mutex); // check if configuration is already open in the right mode. // By the way: Don't allow closing by using this method! @@ -99,7 +99,7 @@ void ConfigAccess::open( /*IN*/ EOpenMode eMode ) // can be called without checks! It does the checks by itself ... // e.g. for already closed or not opened configuration. // Flushing of all made changes will be done here too. - close(); + closeImpl(); // create the configuration provider, which provides sub access points css::uno::Reference< css::lang::XMultiServiceFactory > xConfigProvider = css::configuration::theDefaultProvider::get(m_xContext); @@ -135,7 +135,12 @@ void ConfigAccess::open( /*IN*/ EOpenMode eMode ) */ void ConfigAccess::close() { - osl::MutexGuard g(m_mutex); + std::unique_lock g(m_mutex); + closeImpl(); +} + +void ConfigAccess::closeImpl() +{ // check already closed configuration if (m_xConfig.is()) { commit c3b968a2f1e8e824ace86c37d0e500440374bd09 Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Sun Nov 21 12:35:24 2021 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Sun Nov 21 15:47:05 2021 +0100 osl::Mutex->std::mutex in StatusIndicatorFactory Change-Id: I2365e172ef8d631f30cfffdb650ebcb3035f77f4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125620 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/framework/source/helper/statusindicatorfactory.cxx b/framework/source/helper/statusindicatorfactory.cxx index 285d53fb683f..0a87c9bea258 100644 --- a/framework/source/helper/statusindicatorfactory.cxx +++ b/framework/source/helper/statusindicatorfactory.cxx @@ -33,7 +33,7 @@ #include <comphelper/sequenceashashmap.hxx> #include <unotools/mediadescriptor.hxx> #include <vcl/svapp.hxx> -#include <osl/mutex.hxx> +#include <mutex> #include <rtl/ref.hxx> #include <officecfg/Office/Common.hxx> @@ -512,15 +512,15 @@ void StatusIndicatorFactory::impl_reschedule(bool bForce) if (!bReschedule) return; - static osl::Mutex rescheduleLock; + static std::mutex rescheduleLock; // SAFE -> - osl::ResettableMutexGuard aRescheduleGuard(rescheduleLock); + std::unique_lock aRescheduleGuard(rescheduleLock); if (m_nInReschedule != 0) return; ++m_nInReschedule; - aRescheduleGuard.clear(); + aRescheduleGuard.unlock(); // <- SAFE { @@ -529,7 +529,7 @@ void StatusIndicatorFactory::impl_reschedule(bool bForce) } // SAFE -> - aRescheduleGuard.reset(); + aRescheduleGuard.lock(); --m_nInReschedule; }