diff options
| author | ruki <[email protected]> | 2024-01-25 00:48:12 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2024-01-25 12:10:23 +0800 |
| commit | fce0864f0973d5ea72527c2f4fe9f16e142cde81 (patch) | |
| tree | 01738cafa11430f2d6fc31ce39e27bf6a6f992ea | |
| parent | fba862bb13f8780dd01ce85be8ac7c5709289b6d (diff) | |
improve unlock
| -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 |
