reset entering of currently active state when exiting a state machine #31
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi there,
I had an issue with a state being in a state machine container inside a concurrent container. This concurrency got called multiple times. A simplified version is depicted below:
Now, when the preemption_listener stops the concurrency, the do_action-state gets preempted (which is great), and we continue with do_some_more_stuff
After some intermediate states we get back to our concurrency and then it gets exited immediately saying that do_action is preempted.
After digging for a while it turns out, that on_enter of the do_action state does not get called in the second run. The concurrency sets the _entering member inside the StateMachine container, and this exits the currently active state (which is do_action), but it doesn't reset the _entering member of do_action, so it gets skipped the next time the state is visited.
Is this behavior intentional or was it simply forgotten there? This pull request resets the _entering member for the currently active state on a state-machine exit. If this is somehow not desired, then please reject this PR, maybe with a clarification on why that is the case.
Cheers
Felix