Patent ID: 7209918

Claim:
For use in a multi-thread environment, a method of locking an object to permit a thread to exclusively execute at least a portion of a routine associated with the object, the method comprising: receiving a request to access the object from a first thread; determining if the object is owned by the first thread; if the object is owned by a second thread, locking the object and setting a lock owner field to identify the first thread via an atomic execution; and if the object is owned by the first thread, locking the object and setting the lock owner field to identify the first thread without an atomic execution, wherein locking the object without an atomic execution comprises: determining if a first flag field associated with the object has a first predetermined state; if the first flag field has the first predetermined state, setting a second flag field associated with the object to a second predetermined state; verifying that the first flag field still has the first predetermined state.