summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2024-06-05 06:57:10 +0800
committerGitHub <[email protected]>2024-06-05 06:57:10 +0800
commit868096f509b4af29e9d3f7a390ddf9f94f6eaa5b (patch)
treee195f3593430be7f11848b7393bc83a97c9b512c
parent94f3f0df160d69dcd52d0c01573ca40ad8bdae01 (diff)
parentfce9aa8d62f09d20b79d664b134278d841dafe44 (diff)
Merge pull request #5189 from xmake-io/distcc
fix distcc
-rw-r--r--xmake/modules/async/runjobs.lua15
1 files changed, 9 insertions, 6 deletions
diff --git a/xmake/modules/async/runjobs.lua b/xmake/modules/async/runjobs.lua
index 1f59a7359..0c2a6f366 100644
--- a/xmake/modules/async/runjobs.lua
+++ b/xmake/modules/async/runjobs.lua
@@ -157,6 +157,7 @@ function main(name, jobs, opt)
local abort = false
local abort_errors
local progress_wrapper = {}
+ local job_pending
progress_wrapper.current = function ()
return count
end
@@ -192,24 +193,26 @@ function main(name, jobs, opt)
local distccjob = false
if not jobs_cb then
+ -- get free job
+ job = job_pending and job_pending or jobs:getfree()
+ if not job then
+ break
+ end
+
-- we can only continue to run the job with distcc if local jobs are full
if distcc and index >= local_max then
if job.distcc then
distccjob = true
else
+ job_pending = job
break
end
end
- -- get free job
- job = jobs:getfree()
- if not job then
- break
- end
-
-- get run function
jobfunc = job.run
jobname = job.name
+ job_pending = nil
else
jobname = tostring(index)
end