diff options
| -rw-r--r-- | tests/modules/async/jobgraph.lua | 4 | ||||
| -rw-r--r-- | xmake/modules/async/jobgraph.lua | 12 |
2 files changed, 11 insertions, 5 deletions
diff --git a/tests/modules/async/jobgraph.lua b/tests/modules/async/jobgraph.lua index dd8cb05f8..7a0b87c65 100644 --- a/tests/modules/async/jobgraph.lua +++ b/tests/modules/async/jobgraph.lua @@ -1,7 +1,7 @@ -import("core.base.scheduler") import("async.jobgraph") function main() - + local gh = jobgraph.new() + print(gh) end 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 |
