Claims
- 1. A method for avoiding using a locking mechanism when a thread having a context requests to use an object having a scope and having an owner of said scope, said method comprising:
determining if said owner is the same as said context; if said owner is the same as said context, then avoiding using locking mechanism; if said owner is not the same as said context, then promoting a lock on said object's scope.
- 2. The method of claim 1, further comprising:
initially setting said object's scope's owner to a current context of a current thread when said object's scope is created; resetting said object's scope's owner to a second thread's context when said second thread claims exclusive ownership of said scope; and setting said object's scope's owner to null when said ownership is shared.
- 3. A method for locking an object having an ownership attribute, wherein a first thread having a first context makes a first request to a JavaScript engine at a first time, said first request comprising using said object, and a second thread having a second context makes a second request to the JavaScript engine at a second and later time, said second request comprising using said object, said method comprising:
said JavaScript engine determining if said first request is finished with said object; if said first request is not finished with said object, then:
said JavaScript engine comparing said second context of said second thread with said ownership attribute of said object; if said comparison is different, then suspending said second request until said first request is finished with said object; said JavaScript engine setting said ownership attribute of said object to null; said JavaScript engine resuming said second request; otherwise, said JavaScript engine setting said ownership attribute of said object to said second context and processing said second request.
- 4. An apparatus for avoiding using a locking mechanism when a thread having a context requests to use an object having a scope and having an owner of said scope, said apparatus comprising:
means for determining if said owner is the same as said context; if said owner is the same as said context, then means for avoiding using locking mechanism; if said owner is not the same as said context, then means for promoting a lock on said object's scope.
- 5. The apparatus of claim 4, further comprising:
means for initially setting said object's scope's owner to a current context of a current thread when said object's scope is created; means for resetting said object's scope's owner to a second thread's context when said second thread claims exclusive ownership of said scope; and means for setting said object's scope's owner to null when said ownership is shared.
- 6. An apparatus for locking an object having an ownership attribute, wherein a first thread having a first context makes a first request to a JavaScript engine at a first time, said first request comprising using said object, and a second thread having a second context makes a second request to the JavaScript engine at a second and later time, said second request comprising using said object, said method comprising:
means for said JavaScript engine determining if said first request is finished with said object; if said first request is not finished with said object, then:
means for said JavaScript engine comparing said second context of said second thread with said ownership attribute of said object; if said comparison is different, then means for suspending said second request until said first request is finished with said object; means for said JavaScript engine setting said ownership attribute of said object to null; means for said JavaScript engine resuming said second request; otherwise, means for said JavaScript engine setting said ownership attribute of said object to said second context and processing said second request.
CROSS-REFERENCE TO RELATED APPLICATIONS
[0001] This application claims priority to U.S. Provisional patent application No. 60/332,641 filed Nov. 13, 2001.
Provisional Applications (1)
|
Number |
Date |
Country |
|
60332641 |
Nov 2001 |
US |