comphelper/source/misc/threadpool.cxx | 7 +++++++ 1 file changed, 7 insertions(+)
New commits: commit af361b464b46dcc39a1bb4ab098a6ddf6ff40a53 Author: Luboš Luňák <l.lu...@collabora.com> AuthorDate: Thu Nov 26 14:58:59 2020 +0100 Commit: Luboš Luňák <l.lu...@collabora.com> CommitDate: Mon Nov 30 13:16:02 2020 +0100 handle a possible (unlikely?) deadlock in threadpool cleanup Change-Id: I4886989816662bad50db145fd1ff1466e8a3a140 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106700 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lu...@collabora.com> diff --git a/comphelper/source/misc/threadpool.cxx b/comphelper/source/misc/threadpool.cxx index 3c335e7f4761..4ff7bac3aede 100644 --- a/comphelper/source/misc/threadpool.cxx +++ b/comphelper/source/misc/threadpool.cxx @@ -167,7 +167,14 @@ void ThreadPool::shutdownLocked(std::unique_lock<std::mutex>& aGuard) else { while( !maTasks.empty() ) + { maTasksChanged.wait( aGuard ); + // In the (unlikely but possible?) case pushTask() gets called meanwhile, + // its notify_one() call is meant to wake a up a thread and process the task. + // But if this code gets woken up instead, it could lead to a deadlock. + // Pass on the notification. + maTasksChanged.notify_one(); + } } assert( maTasks.empty() ); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits