hekailiang / squirrel

squirrel-foundation is a State Machine library, which provided a lightweight, easy use, type safe and programmable state machine implementation for Java.
http://hekailiang.github.io/squirrel/
Other
2.19k stars 540 forks source link

修复 processEvents 中可能因为并发执行导致 event 未及时处理问题 #138

Open yinwoods opened 2 years ago

yinwoods commented 2 years ago

fix issue

137

修改后的效果是每当线程离开 processEvents 方法时,必须保证 queuedEvents 队列被清空,从而避免有消息未处理

yinwoods commented 1 year ago

之前的改法有问题,仍然存在丢消息的可能,现在将外层改为 for 循环,确保离开方法时,queuedEvents 会被清空