摘要 |
The invention relates to a method of providing thread locking within a multi-threading object-oriented computer program. Each object (400, 500, 600) includes a reserved lock word which is initially set to zero to indicate that the object is unlocked. When the object is to be locked, the word is changed to a pointer (630) which points to a particular memory block (710) within a separate lock pool (700). That memory block contains all the necessary locking information for the object. When the object is to be unlocked, the pointer (630) is deleted, and the lock word set back to zero. The corresponding block (710) in the lock pool is then released, and may be reused for other locking information or for other data that may be required to be stored by the executing application.
|