From 370723becd67277b53696a440dcaa19e9ad843b9 Mon Sep 17 00:00:00 2001 From: Joel Rosdahl Date: Sun, 26 Oct 2025 15:55:13 +0100 Subject: [PATCH] enhance: Let ThreadPool log failed tasks --- src/ccache/util/threadpool.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ccache/util/threadpool.cpp b/src/ccache/util/threadpool.cpp index 0e579f8f..5d8d0457 100644 --- a/src/ccache/util/threadpool.cpp +++ b/src/ccache/util/threadpool.cpp @@ -18,6 +18,8 @@ #include "threadpool.hpp" +#include + namespace util { ThreadPool::ThreadPool(size_t number_of_threads, size_t task_queue_max_size) @@ -90,8 +92,10 @@ ThreadPool::worker_thread_main() m_task_popped_condition.notify_one(); try { task(); + } catch (const std::exception& e) { + LOG("Thread pool task failed: {}", e.what()); } catch (...) { - // We'll have to ignore it for now. + LOG_RAW("Thread pool task failed with unknown exception"); } } } -- 2.47.3