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
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];
Construct the lock identifier for the did/segment/offset
Set: PROC [ trans: YggEnvironment.TransID, lock: LockID, mode: LockMode, wait: BOOLFALSE] RETURNS [granted: BOOL];
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.
ModeReleasableSet: TYPE = PACKED ARRAY LockMode OF ModeReleasable;
ModeReleasable: TYPE = {no, yes} ← no;
Release: PROC [trans: YggEnvironment.TransID, lock: LockID,
mode: LockMode] RETURNS [released: BOOL];
! Error {lockUnreleasable, unknown};
Releases a lock previously set by the same transaction with this mode.
ReleaseTransactionLocks: PROC [trans: YggEnvironment.TransID, directoryOnly: BOOL] RETURNS [numberReleased: INT];
! Error {lockUnreleasable, unknown};
Releases all locks (or all directory locks) previously set by this transaction.
Error: ERROR [type: ErrorType];
ErrorType: TYPE = {lockUnreleasable, unknown, unknownLock};
Failed: ERROR [why: YggEnvironment.LockFailure];
{conflict, timeout}
TransAborting: ERROR;
END.
Hauser, March 8, 1985 10:38:48 am PST
Nodified, added copyright.