Lock modes are used to specify locks and to report on the locks which have been set. PtLockMode is actually just a typedef:
The following tablelists all possible values for PtLockMode, summarizes the read/write/delete restrictions imposed by each lock type, and shows the operations guaranteed to the locking process:
Lock Mode | Guarantees for my process | Restrictions for other processes |
PtLK_NONE | none | none |
PtLK_READvDELETE | read | can't delete |
PtLK_READvWRITE | read | can't write or delete |
PtLK_WRITEvWRITE | read, write | can't write or delete |
PtLK_DELETEvWRITE | read, write, delete | can't write, or delete |
PtLK_DELETEvREAD | read, write, delete | can't read, write, or delete |
PtLK_EXCLUSIVE | read, write, delete | can't read, write, or delete |
transaction write lock | read, write | can't write or delete |
transaction delete lock | read, write, delete | can't write or delete |
You can lock an object that is already locked as long as your lock does not interfere with the purpose of any existing lock. The following table shows the locks which may be set if other locks already exist:
Current Lock | RvD | RvW | WvW | DvW | DvR | EXC |
PtLK_NONE | OK | OK | OK | OK | OK | OK |
PtLK_READvDELETE | OK | OK | OK | fails | fails | fails |
PtLK_READvWRITE | OK | OK | fails | fails | fails | fails |
PtLK_WRITEvWRITE | OK | fails | fails | fails | fails | fails |
PtLK_DELETEvWRITE | fails | fails | fails | fails | fails | fails |
PtLK_DELETEvREAD | fails | fails | fails | fails | fails | fails |
PtLK_EXCLUSIVE | fails | fails | fails | fails | fails | fails |
transaction write lock | OK | fails | fails | fails | fails | fails |
transaction delete lock | fails | fails | fails | fails | fails | fails |
Since exclusive access implies that you are the only person who has an object, PtLK_EXCLUSIVE will fail if another process already has the object in memory.
Copyright (c) 1996 POET Software, Inc. All rights reserved. Reproduction in whole or in part in any form or medium without the express permission of POET Software, Inc. is prohibited.