State Machine
Thread-safe implementation of StateMachine with event-driven state transitions.
This implementation provides:
Thread-safe lifecycle management
Event-driven state transitions with guards and side effects
Observer pattern for state change notifications
Zero external dependencies (coroutine-friendly but not dependent)
Parameters
S
The type of states in the state machine
E
The type of events that can trigger transitions