YggFileLock.mesa
Copyright Ó 1985, 1988 by Xerox Corporation. All rights reserved.
Lock operations specialized to files
Last edited by:
Taft on April 6, 1983 4:58 pm
Carl Hauser, January 8, 1986 11:29:20 am PST
Bob Hagmann May 3, 1988 9:59:42 am PDT
DIRECTORY
YggEnvironment,
YggInternal,
YggOpenDoc,
YggFileLockFormat,
YggTransactionMap;
YggFileLock: CEDAR DEFINITIONS =
BEGIN
LockMode: TYPE = YggEnvironment.LockMode;
LockOption: TYPE = YggEnvironment.LockOption;
PageNumber: TYPE = YggEnvironment.PageNumber;
PageRun: TYPE = YggEnvironment.PageRun;
AssertedPageLock: TYPE = LockMode [read..write]; -- subranges of LockMode as applied to files
AssertedFileLock: TYPE = LockMode [read..readIntendWrite];
IntentionFileLock: TYPE = LockMode [intendRead..intendWrite];
AcquireFileLock: PROCEDURE [doc: YggOpenDoc.OpenDoc, requested: LockOption, minimum: LockMode];
! Lock.Failed, Lock.TransAborting;
Acquires the MAX of requested.mode and minimum for the file.
ReleaseFileLock: PROCEDURE [doc: YggOpenDoc.OpenDoc];
! Lock.Error {unknown};
Releases a file lock previously set by AcquireFileLock. Note that locks are reference-counted and are not removed (or downgraded) until one Release has been done for each Acquire. A file lock of any strength may be released; it is the client's responsibility to ensure consistency. Attempts to release nonexistent locks are ignored.
IsWholeFileLock: PROCEDURE [lockID: YggInternal.LockID] RETURNS [BOOLEAN];
IsWholeFileLock: PROCEDURE [lockID: YggInternal.LockID] RETURNS [BOOLEAN] ~ INLINE { RETURN[ LOOPHOLE[lockID.subSubEntity, YggFileLockFormat.FileLockSubID].type = file ] };
ReleaseFile: PROCEDURE [doc: YggOpenDoc.OpenDoc];
! Lock.Error {unknown};
Releases file and page locks previously set by AcquireFileLock and AcquirePageLocks with LockMode = Read. Reference counts are ignored. Attempts to release nonexistent locks are ignored.
AcquirePageLocks: PROCEDURE [doc: YggOpenDoc.OpenDoc, pageRun: PageRun, requested: LockOption,
minimum: AssertedPageLock];
! Lock.Failed, Lock.TransAborting;
Acquires the MAX of requested.mode and minimum for the specified page(s), and upgrades the file lock if necessary. Does not acquire page locks already subsumed by a whole-file lock. Lock.Failed may be raised after some of the pages have already been locked, and those locks may not have been released.
ReleasePageLocks: PROCEDURE [doc: YggOpenDoc.OpenDoc, pageRun: PageRun, mode: LockMode ← read];
Releases page lock(s) previously set by AcquirePageLocks iff they are currently locked in the specified mode. (A non-default mode should not be passed unless you know what you are doing.) Note that locks are reference-counted and are not removed (or downgraded) until one Release has been done for each Acquire. Attempts to release locks other than mode are ignored without error indication, as are attempts to release nonexistent locks. File intention locks that were set while acquiring the page lock(s) are NOT released.
AcquireSizeLock: PROCEDURE [doc: YggOpenDoc.OpenDoc, requested: LockOption, minimum: AssertedPageLock];
! Lock.Failed, Lock.TransAborting;
Acquires the MAX of requested.mode and minimum for the file's size.
AcquireVolumeGroupLock: PROCEDURE [volumeGroupID: YggEnvironment.VolumeGroupID, trans: YggTransactionMap.TransHandle, requested: LockOption, minimum: AssertedPageLock];
! Lock.Failed, Lock.TransAborting;
Acquires the MAX of requested.mode and minimum for the volume group.
END.
Hauser, March 7, 1985 2:54:15 pm PST
Added copyright.