Create two threads and move state machine to one of them