diff options
| author | ruki <[email protected]> | 2016-06-17 09:17:47 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2016-06-17 09:17:47 +0800 |
| commit | 24f0308a0de62af17a7be8080250bb08aa0a2c4c (patch) | |
| tree | cfd77e8101711e65bcf1f987050ebe01940f8bc9 | |
| parent | 7981a59dbd3263bb1bffee42fc680118a465b869 (diff) | |
fix builder bug for coroutine
| -rwxr-xr-x | xmake/actions/build/builder.lua | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/xmake/actions/build/builder.lua b/xmake/actions/build/builder.lua index 5625eb0f8..ee4c7eb5f 100755 --- a/xmake/actions/build/builder.lua +++ b/xmake/actions/build/builder.lua @@ -116,11 +116,6 @@ function _build_object(target, index) -- run cmd with coroutine os.corun(command) - - -- check the object file - while not os.isfile(objectfile) do - coroutine.yield() - end end -- make objects for the given target @@ -136,7 +131,7 @@ function _build_objects(target) repeat -- consume tasks - local finished = {} + local pendings = {} for i, task in ipairs(tasks) do -- get job @@ -145,22 +140,20 @@ function _build_objects(target) -- get job index local job_index = task[2] - -- get status + -- pending? local status = coroutine.status(job) + if status ~= "dead" then - -- finished? - if status == "dead" then - table.insert(finished, i) - else -- resume it coroutine.resume(job, job_index) + + -- append the pending task + table.insert(pendings, task) end end - -- remove finished tasks - for _, i in ipairs(finished) do - table.remove(tasks, i) - end + -- update the pending tasks + tasks = pendings -- produce tasks while #tasks < jobs and index <= total do |
