diff options
| author | ruki <[email protected]> | 2025-11-15 20:58:24 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2025-11-15 20:58:24 +0800 |
| commit | 8e22161532841d2f9cc293e8a88a8f1cc2527cdf (patch) | |
| tree | e2bfa0b6718573555d70a0dfd47e2da93a68621d | |
| parent | 5ddbc82c72372ad62ac3541dcd3bb93360ef05ad (diff) | |
improve graph and jobgraph
| -rw-r--r-- | xmake/modules/async/jobgraph.lua | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/xmake/modules/async/jobgraph.lua b/xmake/modules/async/jobgraph.lua index 1b87ca110..a1abbf86d 100644 --- a/xmake/modules/async/jobgraph.lua +++ b/xmake/modules/async/jobgraph.lua @@ -28,6 +28,7 @@ import("core.base.hashset") local jobqueue = jobqueue or object {_init = {"_jobgraph", "_dag"}} local jobgraph = jobgraph or object {_init = {"_name", "_jobs", "_size", "_dag", "_groups", "_bridge_nodes", "_bridge_from", "_bridge_to"}} +-- attach a job to existing bridge nodes of its group (if any) function jobgraph:_attach_job_to_bridges(job, group_name) local outbound = self._bridge_from[group_name] local inbound = self._bridge_to[group_name] @@ -46,6 +47,7 @@ function jobgraph:_attach_job_to_bridges(job, group_name) end end +-- ensure a reusable bridge node exists between two groups function jobgraph:_ensure_bridge(from_group, to_group) local key = from_group .. "->" .. to_group local bridge = self._bridge_nodes[key] @@ -140,6 +142,7 @@ function jobgraph:add(name, run, opt) self._groups[group_name] = groups end table.insert(groups, job) + -- ensure bridges (if any) are updated for new members self:_attach_job_to_bridges(job, group_name) end for _, group_name in ipairs(self._current_groups or {}) do |
