summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2021-05-19 22:32:23 +0800
committerruki <[email protected]>2021-05-19 22:32:23 +0800
commitdbb5ca5a87167ac5869b71b16bb260320f231afd (patch)
tree03573bc0cbc33c0edd42ae9fb92531e1a246994d
parent45969bdf3890c1ee4d1614efd1eb9e9d9adc9093 (diff)
improve runjobs
-rw-r--r--xmake/core/base/scheduler.lua2
-rw-r--r--xmake/modules/private/async/runjobs.lua13
2 files changed, 14 insertions, 1 deletions
diff --git a/xmake/core/base/scheduler.lua b/xmake/core/base/scheduler.lua
index c33b5c7f0..1165538d7 100644
--- a/xmake/core/base/scheduler.lua
+++ b/xmake/core/base/scheduler.lua
@@ -273,7 +273,7 @@ function scheduler:_co_curenvs_update(envs)
-- get running coroutine
local running = self:co_running()
- if not running or not running:is_isolated() then
+ if not running then
return
end
diff --git a/xmake/modules/private/async/runjobs.lua b/xmake/modules/private/async/runjobs.lua
index 6a2964a90..7ff3b5090 100644
--- a/xmake/modules/private/async/runjobs.lua
+++ b/xmake/modules/private/async/runjobs.lua
@@ -73,6 +73,14 @@ function main(name, jobs, opt)
progress_helper = progress.new(nil, opt)
end
+ -- isolate environments
+ local is_isolated = false
+ local co_running = scheduler.co_running()
+ if co_running and opt.isolate then
+ is_isolated = co_running:is_isolated()
+ co_running:isolate(true)
+ end
+
-- run timer
local stop = false
local running_jobs_indices = {}
@@ -235,6 +243,11 @@ function main(name, jobs, opt)
-- wait all jobs exited
scheduler.co_group_wait(group_name)
+ -- restore isolated environments
+ if co_running and opt.isolate then
+ co_running:isolate(is_isolated)
+ end
+
-- stop timer
stop = true