Patent ID: 7681197

Claim:
A computer readable medium comprising computer readable code embodied therein for managing nested monitor locks in a computer program, the computer readable code when executed for causing a computer system to: execute an application having at least a first thread and a second thread, the first thread executing an outer software module and the second thread executing an internal software module, wherein a non-synchronized procedure is processed by the application, the non-synchronized procedure enabling the second thread to acquire an outer monitor of the outer software module and an inner monitor of the internal software module, and depend on the first thread to complete an action of the first thread that requires using the outer monitor of the outer software module and the inner monitor of the internal software module; call an internal API during execution by the second thread, the internal API saving a recursion lock count of the second thread and the second thread releasing the outer monitor of the outer software module once the recursion lock count has been saved, wherein the recursion lock count identifies a number of times the second thread acquired the outer monitor; initiate a release of the inner monitor of the internal software module by the second thread, the second thread pausing the actions of the second thread until the second thread can reacquire the inner monitor of the internal software module; complete the action of the first thread after the outer monitor of the outer software module and the inner monitor of the internal software module are released by the second thread, the completing of the action of the first thread being allowed as the outer monitor of the outer software module and the inner monitor of the internal software module were released by the second thread, and wherein the first thread releasing the outer monitor of the outer software module and the inner monitor of the internal software module once the action of the first thread has completed; notify the second thread of the release of the outer monitor of the outer software module by the first thread, the second thread releasing the inner monitor of the internal software module after the notification is received; call the internal API to restore the recursion lock count of the second thread, the recursion lock count of the second thread being previously stored by the internal API, wherein restoring the recursion lock count restores the number of times the second thread acquires the outer monitor; and complete the actions of the second thread, the second thread being allowed to complete its actions after the recursion lock count of the second thread has been restored and after the second thread reacquires the outer monitor of the outer software module and the inner monitor of the internal software module.