Patent ID: 8510738

Claim:
In a computer comprising at least one processor, a method for providing to a plurality of threads access to a resource, the method comprising: requesting, by a first thread of the plurality of threads being executed by the at least one processor, access to the resource; in response to first determining that the requested access to the resource is locked by a second thread of the plurality of threads: setting a state of an indicator where the set state indicates that the requested access to the resource is locked, and continuously checking, by the first thread that is being executed in a user mode of the computer, whether the requested access to the resource is released based on the state of the indicator; after performing the continuously checking for a period of time, transitioning the first thread into a kernel mode; and in response to the transitioning: second determining a state of the indicator, in response to the second determining that the state of the indicator indicates that the requested access to the resource is released, returning the first thread into the user mode without transitioning the first thread into a sleep mode, and in response to the second determining that the state of the indicator indicates that the requested access to the resource is locked, transitioning the first thread into the sleep mode.