Message queues are a way to solve your problem.
If you want to feed your state machine with external events from other threads, they can write these events to the message queue, which will be considered by your state machine.
, , , , MQ.
, . , , , : , , ...