TiogaLocksPrivateImpl.mesa Edited by Paxton on October 11, 1982 10:27 am
DIRECTORY
TiogaLocks,
TiogaLocksPrivate,
TiogaNode,
NodeProps;
TiogaLocksPrivateImpl: CEDAR MONITOR
IMPORTS NodeProps
EXPORTS TiogaLocksPrivate = BEGIN OPEN TiogaLocks, TiogaLocksPrivate;
lastRoot: TiogaNode.RefBranchNode;
lastLock: LockRef;
GetLock:
PUBLIC
ENTRY
PROC [root: TiogaNode.RefBranchNode]
RETURNS [lock: LockRef] = {
ENABLE UNWIND => NULL;
IF root = NIL THEN RETURN [NIL];
IF root = lastRoot THEN RETURN [lastLock];
lastRoot ← root;
lock ← lastLock ← NARROW[NodeProps.GetProp[root, $DocumentLock]];
IF lastLock # NIL THEN RETURN;
lock ← lastLock ← NEW[LockRecord];
NodeProps.PutProp[root, $DocumentLock, lock];
};
NodeProps.Register[$DocumentLock, NodeProps.NullRead, NodeProps.NullWrite, NodeProps.NullCopy];
Don't copy document lock or big trouble.
END..