diff options
| author | Dan Engelbrecht <[email protected]> | 2025-12-05 11:44:42 +0100 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2025-12-05 11:44:42 +0100 |
| commit | 0b1f2a2fc614c2e7a2218514fe16e85c4d4e48e1 (patch) | |
| tree | 22d4b7bd944e420e5f949b4f4df34588e5401c64 /src | |
| parent | exists must be called before equivalent (#678) (diff) | |
| download | zen-0b1f2a2fc614c2e7a2218514fe16e85c4d4e48e1.tar.xz zen-0b1f2a2fc614c2e7a2218514fe16e85c4d4e48e1.zip | |
catch exception leaks in windows thread pool (#677)
* catch exception leaks in windows thread pool
* make non-assert exception an error, assert is kept as warning as it is already reported
Diffstat (limited to 'src')
| -rw-r--r-- | src/zencore/workthreadpool.cpp | 22 |
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()); } } |