fixup! joinany

This commit is contained in:
Lewis Russell 2025-05-16 13:28:32 +01:00 committed by Christian Clason
parent 776bcca920
commit d4999c831f
2 changed files with 7 additions and 1 deletions

View file

@ -704,6 +704,12 @@ do -- join()
assert(running(), 'Not in async context')
return drain_iter(M.iter(tasks))
end
--- @param tasks async.Task[]
--- @return integer?, any?, ...?
function M.joinany(tasks)
return M.iter(tasks)()
end
end
return M

View file

@ -42,7 +42,7 @@ local function join(max_jobs, task_funs)
-- As tasks finish, add new ones
for _, task in ipairs(task_funs) do
local finished = a.iter(running)()
local finished = a.joinany(running)
table.remove(running, finished)
table.insert(running, task())
end