diff options
| author | ruki <[email protected]> | 2021-05-12 00:47:11 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2021-05-12 00:47:11 +0800 |
| commit | 39ee9a33df74a4c17bcb5af817954fe0befab12c (patch) | |
| tree | c81f3064b8d99de558526508c5737bdb4583aaa5 | |
| parent | 2879af92ceae099910fe0ea5827c6bb708c5c2fc (diff) | |
improve runjobs
| -rw-r--r-- | xmake/modules/private/async/runjobs.lua | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/xmake/modules/private/async/runjobs.lua b/xmake/modules/private/async/runjobs.lua index 77bb8f2e0..6a2964a90 100644 --- a/xmake/modules/private/async/runjobs.lua +++ b/xmake/modules/private/async/runjobs.lua @@ -73,19 +73,11 @@ function main(name, jobs, opt) progress_helper = progress.new(nil, opt) end - -- avoid main coroutine to change environments - local main_isolated - local co_running = scheduler.co_running() - if co_running then - main_isolated = co_running:is_isolated() - co_running:isolate(false) - end - -- run timer local stop = false local running_jobs_indices = {} if opt.on_timer then - scheduler.co_start_named(name .. "/timer", function () + scheduler.co_start_withopt({name = name .. "/timer", isolate = opt.isolate}, function () while not stop do os.sleep(timeout) if not stop then @@ -98,7 +90,7 @@ function main(name, jobs, opt) end end) elseif showprogress then - scheduler.co_start_named(name .. "/tips", function () + scheduler.co_start_withopt({name = name .. "/tips", isolate = opt.isolate}, function () while not stop do os.sleep(timeout) if not stop then @@ -252,11 +244,6 @@ function main(name, jobs, opt) progress_helper:stop() end - -- restore current main coroutine - if main_isolated ~= nil then - co_running:isolate(main_isolated) - end - -- do exit callback if opt.on_exit then opt.on_exit() |
