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

Skip to content

Commit 470eba8

Browse files
committed
Fix issue BehaviorTree#109
1 parent 2db7bfe commit 470eba8

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/action_node.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,15 @@ NodeStatus AsyncActionNode::executeTick()
129129
void AsyncActionNode::stopAndJoinThread()
130130
{
131131
keep_thread_alive_.store(false);
132-
notifyStart();
132+
if( status() == NodeStatus::RUNNING )
133+
{
134+
halt();
135+
}
136+
else{
137+
// loop in asyncThreadLoop() is blocked at waitStart(). Unblock it.
138+
notifyStart();
139+
}
140+
133141
if (thread_.joinable())
134142
{
135143
thread_.join();

0 commit comments

Comments
 (0)