DIRECTORY Camelot, YggDID, YggEnvironment, YggInternal; YggLock: CEDAR DEFINITIONS = BEGIN LockID: TYPE = YggInternal.LockID; LockSubID: TYPE = YggInternal.LockSubID; nullLockID: LockID = YggInternal.nullLockID; LockMode: TYPE = YggEnvironment.LockMode; MakeLockID: PROC [did: YggDID.DID] RETURNS [lock: LockID]; Set: PROC [ trans: YggEnvironment.TransID, lock: LockID, mode: LockMode, wait: BOOL _ FALSE] RETURNS [granted: BOOL]; ModeReleasableSet: TYPE = PACKED ARRAY LockMode OF ModeReleasable; ModeReleasable: TYPE = {no, yes} _ no; Release: PROC [trans: YggEnvironment.TransID, lock: LockID, mode: LockMode] RETURNS [released: BOOL]; ReleaseTransactionLocks: PROC [trans: YggEnvironment.TransID, directoryOnly: BOOL] RETURNS [numberReleased: INT]; Error: ERROR [type: ErrorType]; ErrorType: TYPE = {lockUnreleasable, unknown, unknownLock}; Failed: ERROR [why: YggEnvironment.LockFailure]; TransAborting: ERROR; END. €YggLock.mesa Copyright Σ 1985, 1988 by Xerox Corporation. All rights reserved. Last edited by KK on 18-Dec-81 13:41:01 MBrown on January 21, 1983 4:43 pm Taft on September 30, 1982 3:01 pm Hauser, May 20, 1985 11:10:09 am PDT Bob Hagmann December 20, 1988 7:54:39 am PST Construct the lock identifier for the did/segment/offset Acquires lock, in lock mode mode, for transaction trans. Locks come in two types: object and directory. Normal locking is done on objects. For directory operations, a separate locking scheme is used. Holding any kind of object lock on an object in no way implies anything about the directory locks, and vice versa. Directory locks are temporary If the lock cannot immediately be acquired because a conflicting lock is already set by another transaction, and wait=FALSE, RETURNS FALSE. If wait=TRUE, waits until the lock can be acquired. ! Error {lockUnreleasable, unknown}; Releases a lock previously set by the same transaction with this mode. ! Error {lockUnreleasable, unknown}; Releases all locks (or all directory locks) previously set by this transaction. {conflict, timeout} Hauser, March 8, 1985 10:38:48 am PST Nodified, added copyright. Κό˜šœ ™ IcodešœB™B—šœ™Jšœ™Jšœ"™"Jšœ"™"K™$K™,—J˜šΟk ˜ Jšœ˜Jšœ˜Jšœ˜Jšœ ˜ J˜J˜—Jšœ œ˜"˜Jšœœ˜"Jšœ œ˜(šœ,˜,J˜—Jšœ œ˜)J˜J˜šΟn œœœ˜:J™8—J˜š žœœFœœœ œ˜uJšœ8™8J™£JšœT™TJš œ!œœœ œ™KJšœ™J˜—Jš œœœœ œ˜BJšœœ˜&J˜šžœœ.˜;Jšœœ œ˜)Jšœ$™$JšœF™FJ˜—š žœœ0œœœ˜qJšœ$™$JšœO™OJ˜J˜—Jšœœ˜Jšœ œ,˜;J˜šœœ#˜0Jšœ™J˜—Jšœœ˜J˜Jšœ˜—™%K™—K™—…—ͺ J