aboutsummaryrefslogtreecommitdiff
path: root/src/zencore/workthreadpool.cpp
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2023-11-17 14:38:13 +0100
committerGitHub <[email protected]>2023-11-17 14:38:13 +0100
commitb0082066596178f7b72d9963bffdec306a5b6250 (patch)
tree83505561e50e8a09237b05bddb579a714344c219 /src/zencore/workthreadpool.cpp
parentuse dynamic port assignment for tests (#545) (diff)
downloadzen-b0082066596178f7b72d9963bffdec306a5b6250.tar.xz
zen-b0082066596178f7b72d9963bffdec306a5b6250.zip
fix named event (#553)
* fix named event timout and test, fix blocking queue
Diffstat (limited to 'src/zencore/workthreadpool.cpp')
-rw-r--r--src/zencore/workthreadpool.cpp16
1 files changed, 14 insertions, 2 deletions
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<IWork> 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());
+ }
}
}