From 4079d471a7fa967c7e28ea3e011d5d55fb7121b1 Mon Sep 17 00:00:00 2001 From: Reece Date: Thu, 19 May 2022 04:07:10 +0100 Subject: [PATCH] [*] Fix a deadlock in auasync --- Source/Async/ThreadPool.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Source/Async/ThreadPool.cpp b/Source/Async/ThreadPool.cpp index 4014688a..2cdb4c22 100644 --- a/Source/Async/ThreadPool.cpp +++ b/Source/Async/ThreadPool.cpp @@ -501,11 +501,14 @@ namespace Aurora::Async } // Dispatch - itr->second->RunAsync(); + auto oops = itr->second; // Remove from our local job queue itr = state->pendingWorkItems.erase(itr); + // Dispatch + oops->RunAsync(); + // Atomically decrement global task counter runningTasks = this->tasksRunning_.fetch_sub(1) - 1; }