summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2024-01-26 22:29:18 +0800
committerruki <[email protected]>2024-01-26 22:29:18 +0800
commit4dc26106cea35b5fed96c58b1684bd4235b3ff4b (patch)
tree53ead282aa69908b820490a5fdf9844fb0f328aa
parent80cf9dbc194a43eb36139977d65d80f590f9264c (diff)
improve co unlock
-rw-r--r--xmake/core/base/scheduler.lua5
1 files changed, 2 insertions, 3 deletions
diff --git a/xmake/core/base/scheduler.lua b/xmake/core/base/scheduler.lua
index 760c24aee..ac7aed9cc 100644
--- a/xmake/core/base/scheduler.lua
+++ b/xmake/core/base/scheduler.lua
@@ -593,9 +593,8 @@ function scheduler:co_unlock(lockname)
if co_waiting_tasks then
local waiting_tasks = co_waiting_tasks[lockname]
if waiting_tasks and #waiting_tasks > 0 then
- local co_task = waiting_tasks[#waiting_tasks]
- if co_task then
- table.remove(waiting_tasks)
+ co_waiting_tasks[lockname] = nil
+ for _, co_task in ipairs(waiting_tasks) do
if co_task:is_suspended() then
local ok, errors = self:co_resume(co_task)
if not ok then