Patent ID: 7539678

Claim:
A method of controlling access to a first data structure, the method comprising: providing a data field within a header of the first data structure stored in a computer memory, the data field containing information about the accessibility of the first data structure, the data field representing a primary lock, wherein the primary lock is configured to indicate a single state of a plurality of states at a given time by changing a plurality of bits used to quickly determine the state of the primary lock, the plurality of states comprising: a state representing the availability of the primary lock; a state representing each of a plurality of thread identifiers in an event a thread has accessed the first data structure; and a state representing the first data structure is in contention; in response to a first thread accessing the first data structure, changing the information about the accessibility of the first data structure in the data field to indicate that the first data structure is not accessible by indicating the identification of the first thread; and in response to an attempt to access the first data structure by a second competing thread while the first thread is accessing the first data structure: determining that the first data structure is inaccessible based on the indication identifying the first thread: changing the information about the accessibility of the first data structure in the data field to indicate that the first data structure is in a state of contention; indicating to the second competing thread that a secondary lock must be acquired in order to gain access to the first data structure, wherein the secondary lock: is associated with a plurality of shared objects; and stores additional information compared to the primary lock; creating, by using a computer, a second data structure associated with the secondary lock, the second data structure being separate from the first data structure, wherein the second data structure includes information about the accessibility of the first data structure; and associating the second data structure with the first data structure; wherein the information included in the second data structure comprises: an event handle data field that stores information associated with a handle for obtaining notifications of events significant to maintaining the secondary lock associated with the first data structure; a thread identifier data field that stores information for identifying the thread that has possession of the primary lock associated with the secondary lock;: a recursion count data field that stores a counter that indicates how many times competing threads have recursively acquired the primary lock: and a waiting count data field that indicates how many competing threads are waiting to acquire the primary lock once the first thread no longer owns the primary lock.