Skip to content

Async Await Support

scottctr edited this page Mar 31, 2018 · 4 revisions

NStateMangager includes StateMachine and StateMachineAsync. If the majority of your actions and conditions are async, just use StateManagerAsync. Usage is virtually the same the same as StateMachine. The actions and conditions just use the Async suffix and require an async method. If you're comfortable using async and await, you shouldn't have any trouble following any of the example code.

Cancellation Support

TODO

ConfigureAwait

TODO

FireTrigger Reentrancy

Be aware that NStateManager doesn't protect your code from simultaneous calls to FireTrigger. In other words, calling FireTrigger starts evaluating the trigger actions and transition conditions immediately -- they don't wait for previous calls to FireTrigger to complete first.

If multiple calls to FireTrigger is a concern for your projects, please share your thoughts here.

Clone this wiki locally