diff --git a/Common/interface/ThreadPool.hpp b/Common/interface/ThreadPool.hpp index ae69cd507..4b80b7b27 100644 --- a/Common/interface/ThreadPool.hpp +++ b/Common/interface/ThreadPool.hpp @@ -185,7 +185,9 @@ RefCntAutoPtr EnqueueAsyncWork(IThreadPool* pThreadPool, virtual void DILIGENT_CALL_TYPE Run(Uint32 ThreadId) override final { - ASYNC_TASK_STATUS TaskStatus = m_Handler(ThreadId); + ASYNC_TASK_STATUS TaskStatus = !m_bSafelyCancel.load() ? + m_Handler(ThreadId) : + ASYNC_TASK_STATUS_CANCELLED; SetStatus(TaskStatus); }