summaryrefslogtreecommitdiff
path: root/xmake/modules/async/jobgraph.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2025-03-18 23:55:15 +0800
committerruki <[email protected]>2025-04-08 15:31:54 +0800
commit1621db050a13474f4d79d02c4d306013770d35b4 (patch)
treecf0df4a94324fd1ad80acf1058e6dcc8921715a4 /xmake/modules/async/jobgraph.lua
parent00ebba39f7e81d2b52bfb3be458f9825e6d7c070 (diff)
add jobgraph.new
Diffstat (limited to 'xmake/modules/async/jobgraph.lua')
-rw-r--r--xmake/modules/async/jobgraph.lua12
1 files changed, 9 insertions, 3 deletions
diff --git a/xmake/modules/async/jobgraph.lua b/xmake/modules/async/jobgraph.lua
index 519544cf2..3fd36194a 100644
--- a/xmake/modules/async/jobgraph.lua
+++ b/xmake/modules/async/jobgraph.lua
@@ -20,17 +20,23 @@
-- imports
import("core.base.object")
+import("core.base.list")
import("core.base.graph")
-- define module
-local jobgraph = jobgraph or object {_init = {"_size"}}
+local jobgraph = jobgraph or object {_init = {"_jobs", "_graph"}}
+
+-- get jobs
+function jobgraph:jobs()
+ return self._jobs
+end
-- tostring
function jobgraph:__tostring()
- return "<jobgraph>"
+ return string.format("<jobgraph:%s>", self:jobs():size())
end
-- new a jobgraph
function new()
- return jobgraph {0}
+ return jobgraph {list.new(), graph.new(true)}
end