diff options
| author | ruki <[email protected]> | 2022-05-14 00:51:52 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2022-05-14 00:51:52 +0800 |
| commit | 952c7a339855b32c83a9baaaa9e3f55929294fdf (patch) | |
| tree | 15b590551f96da14ad2241575185d17e35d84904 /xmake/modules/private/async/runjobs.lua | |
| parent | 95425d9a244a557141107e0113e308664676be7a (diff) | |
improve runjobs
Diffstat (limited to 'xmake/modules/private/async/runjobs.lua')
| -rw-r--r-- | xmake/modules/private/async/runjobs.lua | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/xmake/modules/private/async/runjobs.lua b/xmake/modules/private/async/runjobs.lua index 3d9d36b7d..9179e6a76 100644 --- a/xmake/modules/private/async/runjobs.lua +++ b/xmake/modules/private/async/runjobs.lua @@ -161,12 +161,13 @@ function main(name, jobs, opt) while index < total do scheduler.co_group_begin(group_name, function (co_group) local freemax = comax - #co_group + local local_max = math.min(index + freemax, total) + local total_max = local_max if distcc then - freemax = freemax + distcc:freejobs() + total_max = math.min(index + freemax + distcc:freejobs(), total) end - local max = math.min(index + freemax, total) local jobfunc = jobs_cb - while index < max do + while index < total_max do -- uses job pool? local jobname @@ -191,11 +192,17 @@ function main(name, jobs, opt) job_pending = job break end - job_pending = nil + + -- we can only continue to run the job with distcc if local jobs are full + if index >= local_max and not job.distcc then + job_pending = job + break + end -- get run function jobfunc = job.run jobname = job.name + job_pending = nil else jobname = tostring(index) end |
