diff options
| -rw-r--r-- | xmake/core/base/scheduler.lua | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/xmake/core/base/scheduler.lua b/xmake/core/base/scheduler.lua index 8256bdc43..ece889cfe 100644 --- a/xmake/core/base/scheduler.lua +++ b/xmake/core/base/scheduler.lua @@ -564,8 +564,9 @@ 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 - co_waiting_tasks[lockname] = nil - for _, co_task in ipairs(waiting_tasks) do + local co_task = waiting_tasks[#waiting_tasks] + if co_task then + table.remove(waiting_tasks) local ok, errors = self:co_resume(co_task) if not ok then return false, errors |
