From 8e08c366078fdc9b80670156a15373e42ae2c0ce Mon Sep 17 00:00:00 2001 From: Joel Rosdahl Date: Mon, 15 Sep 2025 21:41:16 +0200 Subject: [PATCH] fix: Don't crash thread pool thread if task throws --- src/ccache/util/threadpool.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/ccache/util/threadpool.cpp b/src/ccache/util/threadpool.cpp index 0bc6542b..2257198d 100644 --- a/src/ccache/util/threadpool.cpp +++ b/src/ccache/util/threadpool.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2019-2024 Joel Rosdahl and other contributors +// Copyright (C) 2019-2025 Joel Rosdahl and other contributors // // See doc/AUTHORS.adoc for a complete list of contributors. // @@ -85,7 +85,11 @@ ThreadPool::worker_thread_main() } m_task_popped_condition.notify_all(); - task(); + try { + task(); + } catch (...) { + // We'll have to ignore it for now. + } } } -- 2.47.3