summaryrefslogtreecommitdiff
path: root/xmake/modules
diff options
context:
space:
mode:
authorruki <[email protected]>2020-03-04 21:00:25 +0800
committerruki <[email protected]>2020-03-04 00:02:32 +0800
commit1ed0690463839fd73d00cd25c1f2e47a7d627546 (patch)
tree6818e24e8a020aaf08e366844118ec83f84f65d0 /xmake/modules
parenta9b635bcfc79a46e307a3b8ba7dee3477191257f (diff)
fix runjobs
Diffstat (limited to 'xmake/modules')
-rw-r--r--xmake/modules/private/async/runjobs.lua7
1 files changed, 6 insertions, 1 deletions
diff --git a/xmake/modules/private/async/runjobs.lua b/xmake/modules/private/async/runjobs.lua
index 215ca8ed5..422df3560 100644
--- a/xmake/modules/private/async/runjobs.lua
+++ b/xmake/modules/private/async/runjobs.lua
@@ -121,7 +121,12 @@ function main(name, jobfunc, opt)
while index < total do
running_jobs_indices = {}
scheduler.co_group_begin(group_name, function ()
- local max = math.min(index + comax, total)
+ local freemax = comax
+ local co_group = scheduler.co_group(group_name)
+ if co_group then
+ freemax = freemax - #co_group
+ end
+ local max = math.min(index + freemax, total)
while index < max do
index = index + 1
table.insert(running_jobs_indices, index)