From: Joel Rosdahl Date: Sun, 26 Oct 2025 14:55:13 +0000 (+0100) Subject: enhance: Let ThreadPool log failed tasks X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=370723becd67277b53696a440dcaa19e9ad843b9;p=thirdparty%2Fccache.git enhance: Let ThreadPool log failed tasks --- 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"); } } }