diff options
| author | ruki <[email protected]> | 2020-02-05 22:37:58 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2020-02-07 22:45:56 +0800 |
| commit | 1cac0feefb18328d14deff5b1fddb95fc7175353 (patch) | |
| tree | 73955166b48a21959622ea71f70b207dea3aa8ef /xmake/modules | |
| parent | 69a092643d7725dce1f6fbf7b90ddb3e6f15370e (diff) | |
improve runjobs timeout
Diffstat (limited to 'xmake/modules')
| -rw-r--r-- | xmake/modules/private/async/runjobs.lua | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/xmake/modules/private/async/runjobs.lua b/xmake/modules/private/async/runjobs.lua index b59bd3a35..1c12bf63c 100644 --- a/xmake/modules/private/async/runjobs.lua +++ b/xmake/modules/private/async/runjobs.lua @@ -28,6 +28,8 @@ function main(name, jobfunc, opt) op = opt or {} local total = opt.total or 1 local comax = opt.comax or total + local timeout = opt.timeout or 500 + assert(timeout < 60000, "runjobs: invalid timeout!") -- show waiting tips? local waitindex = 0 @@ -42,10 +44,9 @@ function main(name, jobfunc, opt) local stop = false local running_jobs_indices if opt.timer then - assert(opt.timeout and opt.timeout < 60000, "runjobs: invalid timer timeout!") scheduler.co_start_named(name .. "/timer", function () while not stop do - os.sleep(opt.timeout) + os.sleep(timeout) if not stop then opt.timer(running_jobs_indices) end @@ -54,7 +55,7 @@ function main(name, jobfunc, opt) elseif showtips then scheduler.co_start_named(name .. "/tips", function () while not stop do - os.sleep(opt.timeout or 300) + os.sleep(timeout) if not stop then waitindex = ((waitindex + 1) % #waitchars) printf("\b" .. waitchars[waitindex + 1]) |
