summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2020-03-05 22:41:54 +0800
committerruki <[email protected]>2020-03-05 10:11:24 +0800
commit2012269ac6d016c6dccd382f0fc14ea1ae0fd054 (patch)
tree0252cd3e047b3582ce0454a74b39729bdeb2af48
parent84bef3947d0f5ea97ad083e4cbac727f67a266a0 (diff)
fix runjobs
-rw-r--r--xmake/modules/private/async/runjobs.lua10
1 files 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