diff options
| author | ruki <[email protected]> | 2024-04-07 23:15:40 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2024-04-07 23:15:40 +0800 |
| commit | b1f552fae364bcc48884b9f3f8d1d52a0531e92e (patch) | |
| tree | cb1b0c4996d1c1f293d74281fd30c71929e46094 | |
| parent | 2a99fd133daea2808253ff1d8545d53c700709af (diff) | |
improve jobpool
| -rw-r--r-- | xmake/modules/private/async/jobpool.lua | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/xmake/modules/private/async/jobpool.lua b/xmake/modules/private/async/jobpool.lua index 342cc096f..10fe90bbe 100644 --- a/xmake/modules/private/async/jobpool.lua +++ b/xmake/modules/private/async/jobpool.lua @@ -106,7 +106,7 @@ function jobpool:pop() -- init leaf jobs first local leafjobs = self._leafjobs - if #leafjobs == 0 then + if leafjobs:empty() then local refs = {} self:_genleafjobs(self:rootjob(), leafjobs, refs) end @@ -116,7 +116,7 @@ function jobpool:pop() -- get job local job = leafjobs:last() - leafjobs:remove(job) + leafjobs:remove_last() -- get parents node local parents = assert(job._parents, "invalid job without parents node!") @@ -129,7 +129,7 @@ function jobpool:pop() p._deps:remove(job) if p._deps:empty() and self._size > 0 then p._leaf = true - table.insert(leafjobs, 1, p) + leafjobs:insert_first(p) end end end @@ -149,10 +149,6 @@ function jobpool:pop() end end --- get free jobs -function jobpool:freejobs() -end - -- enter group -- -- @param name the group name @@ -194,7 +190,7 @@ function jobpool:_genleafjobs(job, leafjobs, refs) end else job._leaf = true - leafjobs:push(job) + leafjobs:insert_last(job) end end |
