xmake-async-jobs
Installation
SKILL.md
Async Jobs, Parallelism & Scheduling
Xmake's Lua layer has a cooperative coroutine scheduler underneath. Any on_build/on_build_files/on_install hook you write runs inside it, and can spawn parallel subjobs via async.runjobs (with three different input shapes) or by yielding explicitly via the scheduler.
Use this skill when writing a rule or task that needs to do work in parallel — file generation, batch downloads, distributed jobs, etc.
1. async.runjobs — the main entry point
import("async.runjobs")
runjobs("my-jobs", function (index, total, opt)
print("job %d/%d", index, total)
os.sleep(500)
end, {
total = 100,
comax = 6
})