diff options
| author | ruki <[email protected]> | 2020-05-31 11:04:42 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2020-05-31 11:04:42 +0800 |
| commit | e92e78dfddbc77ce69c8963731a2b7a798f3a0c6 (patch) | |
| tree | 10b4bbedfea0d56b1eeaf883b5b1a5db5cc22efd /xmake/modules/private/async/runjobs.lua | |
| parent | bd6bda1b207af221c574d4f85639cdf46f01710f (diff) | |
improve runjobs
Diffstat (limited to 'xmake/modules/private/async/runjobs.lua')
| -rw-r--r-- | xmake/modules/private/async/runjobs.lua | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/xmake/modules/private/async/runjobs.lua b/xmake/modules/private/async/runjobs.lua index cd130e6c9..d9ecdfa58 100644 --- a/xmake/modules/private/async/runjobs.lua +++ b/xmake/modules/private/async/runjobs.lua @@ -35,7 +35,7 @@ end -- asynchronous run jobs -- -- e.g. --- runjobs("test", function (index) print("hello") end, {total = 100, comax = 6, timeout = 1000, timer = function (running_jobs_indices) end}) +-- runjobs("test", function (index) print("hello") end, {total = 100, comax = 6, timeout = 1000, on_timer = function (running_jobs_indices) end}) -- runjobs("test", function () os.sleep(10000) end, { progress = true }) -- runjobs("test", function () os.sleep(10000) end, { progress = { chars = {'/','\'} } }) -- see module private.utils.progress -- @@ -48,7 +48,7 @@ end -- print(idx, total) -- end, root) -- end --- runjobs("test", jobs, {comax = 6, timeout = 1000, timer = function (running_jobs_indices) end}) +-- runjobs("test", jobs, {comax = 6, timeout = 1000, on_timer = function (running_jobs_indices) end}) -- -- function main(name, jobs, opt) @@ -76,12 +76,12 @@ function main(name, jobs, opt) -- run timer local stop = false local running_jobs_indices - if opt.timer then + if opt.on_timer then scheduler.co_start_named(name .. "/timer", function () while not stop do os.sleep(timeout) if not stop then - opt.timer(running_jobs_indices) + opt.on_timer(running_jobs_indices) end end end) @@ -199,8 +199,8 @@ function main(name, jobs, opt) end -- do exit callback - if opt.exit then - opt.exit(errors) + if opt.on_exit then + opt.on_exit(errors) end -- re-throw this errors and abort scheduler @@ -235,7 +235,7 @@ function main(name, jobs, opt) end -- do exit callback - if opt.exit then - opt.exit() + if opt.on_exit then + opt.on_exit() end end |
