qmuntal / stateless

Go library for creating finite state machines
https://wikipedia.org/wiki/Finite-state_machine
BSD 2-Clause "Simplified" License
967 stars 53 forks source link

Calling WaitGroup.Wait during state processing causes Fire to freeze and the state machine to freeze #89

Open NOWXF opened 3 days ago

NOWXF commented 3 days ago

During the event processing of the state machine, the warit of the waitgroup is called, which causes Fire to freeze. Illustrate: In the state machine, i need to use a timer, via time. NewTicker creates timers, timers. C to the end, call Fire to send a signal. When exiting the state, the timer is called to stop, and when the wait coroutine is stopped, the tracking finds that Fire is stuck.

I didn't find a similar problem, please help me.

NOWXF commented 3 days ago

I understand that calling Wait in state handling is not quite correct, and it is not allowed here in the first place. So are there any other recommended solutions to solve the problem?