Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
.idea/
cmake-build-*
cmake-build-*
bazel-bin
bazel-genfiles
bazel-out
bazel-testlogs
bazel-workspace
bazel-babylon
MODULE.bazel
MODULE.bazel.lock
6 changes: 2 additions & 4 deletions src/babylon/anyflow/executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,16 @@ Closure ThreadPoolGraphExecutor::create_closure() noexcept {

int ThreadPoolGraphExecutor::run(GraphVertex* vertex,
GraphVertexClosure&& closure) noexcept {
_executor.submit([captured_closure = ::std::move(closure), vertex]() mutable {
return _executor.submit([captured_closure = ::std::move(closure), vertex]() mutable {
vertex->run(::std::move(captured_closure));
});
return 0;
}

int ThreadPoolGraphExecutor::run(ClosureContext* closure,
Closure::Callback* callback) noexcept {
_executor.submit([=] {
return _executor.submit([=] {
closure->run(callback);
});
return 0;
}

} // namespace anyflow
Expand Down
9 changes: 7 additions & 2 deletions src/babylon/anyflow/vertex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,13 @@ void GraphVertex::invoke(VertexStack& runnable_vertexes) noexcept {
_runnable_vertexes = &runnable_vertexes;
run(GraphVertexClosure(*_closure, *this));
} else {
_builder->graph().executor().run(this,
GraphVertexClosure(*_closure, *this));
GraphVertexClosure closure(*_closure, *this);
if (ABSL_PREDICT_FALSE(0 != _builder->graph().executor().run(this,
::std::move(closure)))) {
// executor.run 返回失败时,closure 可能已被 move,需要重新创建来标记错误
GraphVertexClosure error_closure(*_closure, *this);
error_closure.done(-1);
}
}
} else {
// 不允许平凡模式情况下,不设置_runnable_vertexes
Expand Down