]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
enhance: Let ThreadPool log failed tasks
authorJoel Rosdahl <joel@rosdahl.net>
Sun, 26 Oct 2025 14:55:13 +0000 (15:55 +0100)
committerJoel Rosdahl <joel@rosdahl.net>
Sun, 26 Oct 2025 17:24:21 +0000 (18:24 +0100)
src/ccache/util/threadpool.cpp

index 0e579f8f686b5be1a05bc4d1056d95ae553c3082..5d8d0457f20b290b2084c75394c3a6f5e8576d4b 100644 (file)
@@ -18,6 +18,8 @@
 
 #include "threadpool.hpp"
 
+#include <ccache/util/logging.hpp>
+
 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");
     }
   }
 }