1. A method for controlling sharing of resources in a multi-threaded environment, comprising: entering a finite state machine state sequence; controlling resource-sharing threads using the finite state machine state sequence; and exiting the finite state machine state sequence when shared resource control is complete.