From 2012269ac6d016c6dccd382f0fc14ea1ae0fd054 Mon Sep 17 00:00:00 2001 From: ruki Date: Thu, 5 Mar 2020 22:41:54 +0800 Subject: fix runjobs --- xmake/modules/private/async/runjobs.lua | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/xmake/modules/private/async/runjobs.lua b/xmake/modules/private/async/runjobs.lua index ac0bd01e9..40f59f0bd 100644 --- a/xmake/modules/private/async/runjobs.lua +++ b/xmake/modules/private/async/runjobs.lua @@ -144,24 +144,26 @@ function main(name, jobs, opt) local max = math.min(index + freemax, total) local jobfunc = jobs_cb while index < max do - index = index + 1 -- uses jobs queue? if not jobs_cb then - -- get job priority and run function - local job = jobs[index] + -- get job priority + local job = jobs[index + 1] priority_curr = job.priority or priority_prev assert(priority_curr >= priority_prev, "runjobs: invalid priority(%d < %d)!", priority_curr, priority_prev) - jobfunc = job.run -- priority changed? we need wait all running jobs exited if priority_curr > priority_prev then break end + + -- get run function + jobfunc = job.run end -- start this job + index = index + 1 table.insert(running_jobs_indices, index) scheduler.co_start_named(name .. '/' .. tostring(index), function(i) try -- cgit v1.3.1