Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8d69501

Browse files
committed
fix: empty composed taskflow was causing executor to block
1 parent c2f94ca commit 8d69501

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

taskflow/core/executor.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ inline void Executor::_schedule_unsync(
510510
) const {
511511

512512
// module node need another initialization
513-
if(node->_module != nullptr && !node->is_spawned()) {
513+
if(node->_module != nullptr && !node->_module->empty() && !node->is_spawned()) {
514514
_init_module_node_unsync(node, stack);
515515
}
516516

@@ -526,7 +526,7 @@ inline void Executor::_schedule_unsync(
526526
// here we guarantee to run by a thread so no need to cache the
527527
// size from nodes
528528
for(auto node : nodes) {
529-
if(node->_module != nullptr && !node->is_spawned()) {
529+
if(node->_module != nullptr && !node->_module->empty() && !node->is_spawned()) {
530530
_init_module_node_unsync(node, stack);
531531
}
532532
stack.push(node);
@@ -541,7 +541,7 @@ inline void Executor::_schedule(Node* node, bool bypass) {
541541
assert(_workers.size() != 0);
542542

543543
// module node need another initialization
544-
if(node->_module != nullptr && !node->is_spawned()) {
544+
if(node->_module != nullptr && !node->_module->empty() && !node->is_spawned()) {
545545
_init_module_node(node);
546546
}
547547

@@ -582,7 +582,7 @@ inline void Executor::_schedule(PassiveVector<Node*>& nodes) {
582582
}
583583

584584
for(auto node : nodes) {
585-
if(node->_module != nullptr && !node->is_spawned()) {
585+
if(node->_module != nullptr && !node->_module->empty() && !node->is_spawned()) {
586586
_init_module_node(node);
587587
}
588588
}

0 commit comments

Comments
 (0)