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 /sdext | |
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 'sdext')
-rw-r--r-- | sdext/source/minimizer/pppoptimizertoken.cxx | 2 | ||||
-rw-r--r-- | sdext/source/presenter/PresenterTimer.cxx | 20 |
2 files changed, 11 insertions, 11 deletions
diff --git a/sdext/source/minimizer/pppoptimizertoken.cxx b/sdext/source/minimizer/pppoptimizertoken.cxx index 9130621ff762..1e020bc027a2 100644 --- a/sdext/source/minimizer/pppoptimizertoken.cxx +++ b/sdext/source/minimizer/pppoptimizertoken.cxx @@ -167,7 +167,7 @@ PPPOptimizerTokenEnum TKGet( const OUString& rToken ) { if ( !pHashMap ) { // init hash map - std::lock_guard aGuard( getHashMapMutex() ); + std::scoped_lock aGuard( getHashMapMutex() ); if ( !pHashMap ) { TypeNameHashMap* pH = new TypeNameHashMap; diff --git a/sdext/source/presenter/PresenterTimer.cxx b/sdext/source/presenter/PresenterTimer.cxx index f46fcd288ee0..67281e368b18 100644 --- a/sdext/source/presenter/PresenterTimer.cxx +++ b/sdext/source/presenter/PresenterTimer.cxx @@ -184,7 +184,7 @@ sal_Int32 TimerScheduler::mnTaskId = PresenterTimer::NotAValidTaskId; std::shared_ptr<TimerScheduler> TimerScheduler::Instance( uno::Reference<uno::XComponentContext> const& xContext) { - std::lock_guard aGuard (maInstanceMutex); + std::scoped_lock aGuard (maInstanceMutex); if (mpInstance == nullptr) { if (!xContext.is()) @@ -226,7 +226,7 @@ void TimerScheduler::ScheduleTask (const SharedTimerTask& rpTask) return; { - std::lock_guard aTaskGuard (maTaskContainerMutex); + std::scoped_lock aTaskGuard (maTaskContainerMutex); maScheduledTasks.insert(rpTask); } } @@ -237,7 +237,7 @@ void TimerScheduler::CancelTask (const sal_Int32 nTaskId) // task ids. Therefore we have to do a linear search for the task to // cancel. { - std::lock_guard aGuard (maTaskContainerMutex); + std::scoped_lock aGuard (maTaskContainerMutex); auto iTask = std::find_if(maScheduledTasks.begin(), maScheduledTasks.end(), [nTaskId](const SharedTimerTask& rxTask) { return rxTask->mnTaskId == nTaskId; }); if (iTask != maScheduledTasks.end()) @@ -248,7 +248,7 @@ void TimerScheduler::CancelTask (const sal_Int32 nTaskId) // processed. Mark it with a flag that a) prevents a repeating task // from being scheduled again and b) tries to prevent its execution. { - std::lock_guard aGuard (maCurrentTaskMutex); + std::scoped_lock aGuard (maCurrentTaskMutex); if (mpCurrentTask && mpCurrentTask->mnTaskId == nTaskId) mpCurrentTask->mbIsCanceled = true; @@ -266,12 +266,12 @@ void TimerScheduler::NotifyTermination() } { - std::lock_guard aGuard(pInstance->maTaskContainerMutex); + std::scoped_lock aGuard(pInstance->maTaskContainerMutex); pInstance->maScheduledTasks.clear(); } { - std::lock_guard aGuard(pInstance->maCurrentTaskMutex); + std::scoped_lock aGuard(pInstance->maCurrentTaskMutex); if (pInstance->mpCurrentTask) { pInstance->mpCurrentTask->mbIsCanceled = true; @@ -303,7 +303,7 @@ void SAL_CALL TimerScheduler::run() SharedTimerTask pTask; sal_Int64 nDifference = 0; { - std::lock_guard aGuard (maTaskContainerMutex); + std::scoped_lock aGuard (maTaskContainerMutex); // There are no more scheduled task. Leave this loop, function and // live of the TimerScheduler. @@ -322,7 +322,7 @@ void SAL_CALL TimerScheduler::run() // Acquire a reference to the current task. { - std::lock_guard aGuard (maCurrentTaskMutex); + std::scoped_lock aGuard (maCurrentTaskMutex); mpCurrentTask = pTask; } @@ -356,13 +356,13 @@ void SAL_CALL TimerScheduler::run() // Release reference to the current task. { - std::lock_guard aGuard (maCurrentTaskMutex); + std::scoped_lock aGuard (maCurrentTaskMutex); mpCurrentTask.reset(); } } // While holding maInstanceMutex - std::lock_guard aInstance( maInstanceMutex ); + std::scoped_lock aInstance( maInstanceMutex ); mpLateDestroy = mpInstance; mpInstance.reset(); } |