From 05ab38359ae72f2a54dc0b5f1b84ac5f649c507a Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 3 Aug 2021 11:36:01 +0200 Subject: 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 --- slideshow/source/engine/eventqueue.cxx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'slideshow') diff --git a/slideshow/source/engine/eventqueue.cxx b/slideshow/source/engine/eventqueue.cxx index 0e888db85567..73bf2a398e73 100644 --- a/slideshow/source/engine/eventqueue.cxx +++ b/slideshow/source/engine/eventqueue.cxx @@ -77,7 +77,7 @@ namespace slideshow::internal bool EventQueue::addEvent( const EventSharedPtr& rEvent ) { - std::lock_guard aGuard( maMutex ); + std::scoped_lock aGuard( maMutex ); SAL_INFO("slideshow.eventqueue", "adding event \"" << rEvent->GetDescription() << "\" [" << rEvent.get() @@ -103,7 +103,7 @@ namespace slideshow::internal bool EventQueue::addEventForNextRound( EventSharedPtr const& rEvent ) { - std::lock_guard aGuard( maMutex ); + std::scoped_lock aGuard( maMutex ); SAL_INFO("slideshow.eventqueue", "adding event \"" << rEvent->GetDescription() << "\" [" << rEvent.get() @@ -120,7 +120,7 @@ namespace slideshow::internal bool EventQueue::addEventWhenQueueIsEmpty (const EventSharedPtr& rpEvent) { - std::lock_guard aGuard( maMutex ); + std::scoped_lock aGuard( maMutex ); SAL_INFO("slideshow.eventqueue", "adding event \"" << rpEvent->GetDescription() << "\" [" << rpEvent.get() @@ -140,14 +140,14 @@ namespace slideshow::internal void EventQueue::forceEmpty() { - std::lock_guard aGuard( maMutex ); + std::scoped_lock aGuard( maMutex ); process_(true); } void EventQueue::process() { - std::lock_guard aGuard( maMutex ); + std::scoped_lock aGuard( maMutex ); process_(false); } @@ -257,14 +257,14 @@ namespace slideshow::internal bool EventQueue::isEmpty() const { - std::lock_guard aGuard( maMutex ); + std::scoped_lock aGuard( maMutex ); return maEvents.empty() && maNextEvents.empty() && maNextNextEvents.empty(); } double EventQueue::nextTimeout() const { - std::lock_guard aGuard( maMutex ); + std::scoped_lock aGuard( maMutex ); // return time for next entry (if any) double nTimeout (::std::numeric_limits::max()); @@ -281,7 +281,7 @@ namespace slideshow::internal void EventQueue::clear() { - std::lock_guard aGuard( maMutex ); + std::scoped_lock aGuard( maMutex ); // TODO(P1): Maybe a plain vector and vector.swap will // be faster here. Profile. -- cgit