diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-08-03 11:36:01 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-08-03 12:20:53 +0200 |
commit | 05ab38359ae72f2a54dc0b5f1b84ac5f649c507a (patch) | |
tree | 5830c7ee2442984e0bc804def7bd95ddd8a25410 /framework | |
parent | 5afdcad4c0e7850b18996c549892b9360cd8973f (diff) |
Consolidate on C++17 std::scoped_lock instead of std::lock_guard
as in commit 9376f65a26240441bf9dd6ae1f69886dc9fa60fa
Change-Id: I3ad9afd4d113582a214a4a4bc7eea55e38cd6ff9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119927
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'framework')
-rw-r--r-- | framework/source/helper/statusindicatorfactory.cxx | 34 | ||||
-rw-r--r-- | framework/source/services/dispatchhelper.cxx | 8 |
2 files changed, 21 insertions, 21 deletions
diff --git a/framework/source/helper/statusindicatorfactory.cxx b/framework/source/helper/statusindicatorfactory.cxx index 702436b1dc61..45c96b373f1a 100644 --- a/framework/source/helper/statusindicatorfactory.cxx +++ b/framework/source/helper/statusindicatorfactory.cxx @@ -66,7 +66,7 @@ StatusIndicatorFactory::~StatusIndicatorFactory() void SAL_CALL StatusIndicatorFactory::initialize(const css::uno::Sequence< css::uno::Any >& lArguments) { if (lArguments.hasElements()) { - std::lock_guard g(m_mutex); + std::scoped_lock g(m_mutex); css::uno::Reference< css::frame::XFrame > xTmpFrame; css::uno::Reference< css::awt::XWindow > xTmpWindow; @@ -103,7 +103,7 @@ css::uno::Reference< css::task::XStatusIndicator > SAL_CALL StatusIndicatorFacto void SAL_CALL StatusIndicatorFactory::update() { - std::lock_guard g(m_mutex); + std::scoped_lock g(m_mutex); m_bAllowReschedule = true; } @@ -114,7 +114,7 @@ void StatusIndicatorFactory::start(const css::uno::Reference< css::task::XStatus css::uno::Reference< css::task::XStatusIndicator > xProgress; // SAFE -> ---------------------------------- { - std::lock_guard aWriteLock(m_mutex); + std::scoped_lock aWriteLock(m_mutex); // create new info structure for this child or move it to the front of our stack IndicatorStack::iterator pItem = ::std::find(m_aStack.begin(), m_aStack.end(), xChild); @@ -143,7 +143,7 @@ void StatusIndicatorFactory::reset(const css::uno::Reference< css::task::XStatus css::uno::Reference< css::task::XStatusIndicator > xProgress; // SAFE -> ---------------------------------- { - std::lock_guard aReadLock(m_mutex); + std::scoped_lock aReadLock(m_mutex); // reset the internal info structure related to this child IndicatorStack::iterator pItem = ::std::find(m_aStack.begin(), m_aStack.end(), xChild); @@ -177,7 +177,7 @@ void StatusIndicatorFactory::end(const css::uno::Reference< css::task::XStatusIn sal_Int32 nValue = 0; // SAFE -> ---------------------------------- { - std::lock_guard aWriteLock(m_mutex); + std::scoped_lock aWriteLock(m_mutex); // remove this child from our stack IndicatorStack::iterator pItem = ::std::find(m_aStack.begin(), m_aStack.end(), xChild); @@ -231,7 +231,7 @@ void StatusIndicatorFactory::setText(const css::uno::Reference< css::task::XStat css::uno::Reference< css::task::XStatusIndicator > xProgress; // SAFE -> ---------------------------------- { - std::lock_guard aWriteLock(m_mutex); + std::scoped_lock aWriteLock(m_mutex); IndicatorStack::iterator pItem = ::std::find(m_aStack.begin(), m_aStack.end(), xChild); if (pItem != m_aStack.end()) @@ -263,7 +263,7 @@ void StatusIndicatorFactory::setValue( const css::uno::Reference< css::task::XSt css::uno::Reference< css::task::XStatusIndicator > xProgress; // SAFE -> ---------------------------------- { - std::lock_guard aWriteLock(m_mutex); + std::scoped_lock aWriteLock(m_mutex); IndicatorStack::iterator pItem = ::std::find(m_aStack.begin(), m_aStack.end(), xChild); if (pItem != m_aStack.end()) @@ -296,7 +296,7 @@ void StatusIndicatorFactory::implts_makeParentVisibleIfAllowed() css::uno::Reference< css::uno::XComponentContext > xContext; // SAFE -> ---------------------------------- { - std::lock_guard aReadLock(m_mutex); + std::scoped_lock aReadLock(m_mutex); if (!m_bAllowParentShow) return; @@ -390,7 +390,7 @@ void StatusIndicatorFactory::impl_createProgress() css::uno::Reference< css::awt::XWindow > xWindow; // SAFE -> ---------------------------------- { - std::lock_guard aReadLock(m_mutex); + std::scoped_lock aReadLock(m_mutex); xFrame = m_xFrame; xWindow = m_xPluggWindow; @@ -427,7 +427,7 @@ void StatusIndicatorFactory::impl_createProgress() } } - std::lock_guard g(m_mutex); + std::scoped_lock g(m_mutex); m_xProgress = xProgress; } @@ -436,7 +436,7 @@ void StatusIndicatorFactory::impl_showProgress() css::uno::Reference< css::frame::XFrame > xFrame; // SAFE -> ---------------------------------- { - std::lock_guard aReadLock(m_mutex); + std::scoped_lock aReadLock(m_mutex); xFrame = m_xFrame; } @@ -468,7 +468,7 @@ void StatusIndicatorFactory::impl_showProgress() } } - std::lock_guard g(m_mutex); + std::scoped_lock g(m_mutex); m_xProgress = xProgress; } @@ -477,7 +477,7 @@ void StatusIndicatorFactory::impl_hideProgress() css::uno::Reference< css::frame::XFrame > xFrame; // SAFE -> ---------------------------------- { - std::lock_guard aReadLock(m_mutex); + std::scoped_lock aReadLock(m_mutex); xFrame = m_xFrame; } @@ -501,7 +501,7 @@ void StatusIndicatorFactory::impl_reschedule(bool bForce) { // SAFE -> { - std::lock_guard aReadLock(m_mutex); + std::scoped_lock aReadLock(m_mutex); if (m_bDisableReschedule) return; } @@ -510,7 +510,7 @@ void StatusIndicatorFactory::impl_reschedule(bool bForce) bool bReschedule = bForce; if (!bReschedule) { - std::lock_guard g(m_mutex); + std::scoped_lock g(m_mutex); bReschedule = m_bAllowReschedule; m_bAllowReschedule = false; } @@ -540,7 +540,7 @@ void StatusIndicatorFactory::impl_reschedule(bool bForce) void StatusIndicatorFactory::impl_startWakeUpThread() { - std::lock_guard g(m_mutex); + std::scoped_lock g(m_mutex); if (m_bDisableReschedule) return; @@ -556,7 +556,7 @@ void StatusIndicatorFactory::impl_stopWakeUpThread() { rtl::Reference<WakeUpThread> wakeUp; { - std::lock_guard g(m_mutex); + std::scoped_lock g(m_mutex); std::swap(wakeUp, m_pWakeUp); } if (wakeUp.is()) diff --git a/framework/source/services/dispatchhelper.cxx b/framework/source/services/dispatchhelper.cxx index cfa4a8a2bbe1..30e424df94ff 100644 --- a/framework/source/services/dispatchhelper.cxx +++ b/framework/source/services/dispatchhelper.cxx @@ -95,7 +95,7 @@ css::uno::Any SAL_CALL DispatchHelper::executeDispatch( css::uno::Reference<css::util::XURLTransformer> xParser; /* SAFE { */ { - std::lock_guard aReadLock(m_mutex); + std::scoped_lock aReadLock(m_mutex); xParser = css::util::URLTransformer::create(m_xContext); } /* } SAFE */ @@ -150,7 +150,7 @@ DispatchHelper::executeDispatch(const css::uno::Reference<css::frame::XDispatch> css::uno::UNO_QUERY); /* SAFE { */ { - std::lock_guard aWriteLock(m_mutex); + std::scoped_lock aWriteLock(m_mutex); m_xBroadcaster = xNotifyDispatch; m_aBlockFlag = false; } @@ -184,7 +184,7 @@ DispatchHelper::executeDispatch(const css::uno::Reference<css::frame::XDispatch> */ void SAL_CALL DispatchHelper::dispatchFinished(const css::frame::DispatchResultEvent& aResult) { - std::lock_guard g(m_mutex); + std::scoped_lock g(m_mutex); m_aResult <<= aResult; m_aBlockFlag = true; m_aBlock.notify_one(); @@ -198,7 +198,7 @@ void SAL_CALL DispatchHelper::dispatchFinished(const css::frame::DispatchResultE */ void SAL_CALL DispatchHelper::disposing(const css::lang::EventObject&) { - std::lock_guard g(m_mutex); + std::scoped_lock g(m_mutex); m_aResult.clear(); m_aBlockFlag = true; m_aBlock.notify_one(); |