Patent ID: 7500242

Claim:
A method of managing a lock utilized by a plurality of threads executing on a computing device to coordinate access to a shared resource, the method comprising: selecting by one of the threads, an action to be performed by the thread upon the lock, wherein the action is selected from a group comprising: acquiring the lock, trying to acquire the lock, and releasing the lock; asynchronously querying and receiving a first state of the lock as a current state of the lock by the thread, the lock being considered to be in any one of at least four states in any point in time, the states defined by a state machine associated with the lock; speculatively determining by the thread, a second state of the lock based at least in part on the first state and the selected action; and attempting to perform by the thread, the selected action to transition the lock from the first state to the speculatively determined second state, the attempting including determining if the first state remains the current state of the lock, and, if the first state remains the current state, performing the selected action to transition the current state of the lock to the second state.