From 6ad13e0e5d1caa8e1ffcf7092e1c04011b5df055 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Thu, 20 Jun 2019 09:03:25 +0200 Subject: Demote from std::unique_lock to std::scoped_lock where applicable Change-Id: I53a019f05978bab62ad0da3d0eb08f37f8ec1e18 Reviewed-on: https://gerrit.libreoffice.org/74414 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- comphelper/source/misc/threadpool.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'comphelper') diff --git a/comphelper/source/misc/threadpool.cxx b/comphelper/source/misc/threadpool.cxx index e1b256736cfe..edef87a844f2 100644 --- a/comphelper/source/misc/threadpool.cxx +++ b/comphelper/source/misc/threadpool.cxx @@ -189,7 +189,7 @@ void ThreadPool::shutdownLocked(std::unique_lock& aGuard) void ThreadPool::pushTask( std::unique_ptr pTask ) { - std::unique_lock< std::mutex > aGuard( maMutex ); + std::scoped_lock< std::mutex > aGuard( maMutex ); mbTerminate = false; @@ -296,14 +296,14 @@ ThreadTaskTag::ThreadTaskTag() : mnTasksWorking(0) void ThreadTaskTag::onTaskPushed() { - std::unique_lock< std::mutex > aGuard( maMutex ); + std::scoped_lock< std::mutex > aGuard( maMutex ); mnTasksWorking++; assert( mnTasksWorking < 65536 ); // sanity checking } void ThreadTaskTag::onTaskWorkerDone() { - std::unique_lock< std::mutex > aGuard( maMutex ); + std::scoped_lock< std::mutex > aGuard( maMutex ); mnTasksWorking--; assert(mnTasksWorking >= 0); if (mnTasksWorking == 0) @@ -312,7 +312,7 @@ void ThreadTaskTag::onTaskWorkerDone() bool ThreadTaskTag::isDone() { - std::unique_lock< std::mutex > aGuard( maMutex ); + std::scoped_lock< std::mutex > aGuard( maMutex ); return mnTasksWorking == 0; } -- cgit