Surely process_input will immediately need to retake the lock in order to change FSM state?  Is this a good locking model?