Patent ID: 8302099

Claim:
A method to perform optimistically balanced synchronization in a managed run-time environment, the method comprising: initiating a first optimistically balanced synchronization to acquire a lock of an object, the first optimistically balanced synchronization comprising a first optimistically balanced acquisition and a first optimistically balanced release to be performed on the lock by a same thread and at a same nesting level; releasing the lock after execution of program code covered by the lock if a stored state of the first optimistically balanced release indicates that the first optimistically balanced release is still valid, the stored state of the first optimistically balanced release being initialized prior to execution of the program code to indicate that the first optimistically balanced release is valid; and throwing an exception after execution of the program code covered by the lock if the stored state of the first optimistically balanced release indicates that the first optimistically balanced release is no longer valid, wherein the stored state of the first optimistically balanced release is used to manage subsequent, recursive optimistically balanced synchronizations of the lock without updating a recursion counter associated with the lock.