From b0082066596178f7b72d9963bffdec306a5b6250 Mon Sep 17 00:00:00 2001 From: Dan Engelbrecht Date: Fri, 17 Nov 2023 14:38:13 +0100 Subject: fix named event (#553) * fix named event timout and test, fix blocking queue --- src/zencore/workthreadpool.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src/zencore/workthreadpool.cpp') diff --git a/src/zencore/workthreadpool.cpp b/src/zencore/workthreadpool.cpp index 3a4b1e6a1..bdb9de9dc 100644 --- a/src/zencore/workthreadpool.cpp +++ b/src/zencore/workthreadpool.cpp @@ -150,7 +150,10 @@ struct WorkerThreadPool::Impl for (std::thread& Thread : m_WorkerThreads) { - Thread.join(); + if (Thread.joinable()) + { + Thread.join(); + } } m_WorkerThreads.clear(); @@ -219,7 +222,16 @@ WorkerThreadPool::ScheduleWork(Ref Work) } else { - Work->Execute(); + try + { + Work->Execute(); + } + catch (std::exception& e) + { + Work->m_Exception = std::current_exception(); + + ZEN_WARN("Caught exception when executing worker synchronously: {}", e.what()); + } } } -- cgit v1.2.3