aboutsummaryrefslogtreecommitdiff
path: root/src/zencore/workthreadpool.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/zencore/workthreadpool.cpp')
-rw-r--r--src/zencore/workthreadpool.cpp22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/zencore/workthreadpool.cpp b/src/zencore/workthreadpool.cpp
index e241c0de8..cb84bbe06 100644
--- a/src/zencore/workthreadpool.cpp
+++ b/src/zencore/workthreadpool.cpp
@@ -156,8 +156,22 @@ struct WorkerThreadPool::Impl
m_WorkQueue.pop_front();
}
- ZEN_TRACE_CPU_FLUSH("AsyncWork");
- WorkFromQueue->Execute();
+ try
+ {
+ ZEN_TRACE_CPU_FLUSH("AsyncWork");
+ WorkFromQueue->Execute();
+ WorkFromQueue = {};
+ }
+ catch (const AssertException& Ex)
+ {
+ WorkFromQueue = {};
+ ZEN_WARN("Assert exception in worker thread: {}", Ex.FullDescription());
+ }
+ catch (const std::exception& e)
+ {
+ WorkFromQueue = {};
+ ZEN_ERROR("Caught exception when executing worker synchronously: {}", e.what());
+ }
}
};
@@ -264,7 +278,7 @@ WorkerThreadPool::Impl::WorkerThreadFunction(ThreadStartInfo Info)
catch (const std::exception& e)
{
Work = {};
- ZEN_WARN("Caught exception in worker thread: {}", e.what());
+ ZEN_ERROR("Caught exception in worker thread: {}", e.what());
}
}
else
@@ -319,7 +333,7 @@ WorkerThreadPool::ScheduleWork(Ref<IWork> Work, EMode Mode)
catch (const std::exception& e)
{
Work = {};
- ZEN_WARN("Caught exception when executing worker synchronously: {}", e.what());
+ ZEN_ERROR("Caught exception when executing worker synchronously: {}", e.what());
}
}