Skip to content

Commit

Permalink
ThreadPool: allow task cancellation in EnqueueAsyncWork
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMostDiligent committed Oct 14, 2024
1 parent eb9af01 commit 65ecd01
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Common/interface/ThreadPool.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,9 @@ RefCntAutoPtr<IAsyncTask> 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);
}

Expand Down

0 comments on commit 65ecd01

Please sign in to comment.