SVStoragePoolsImpl.mesa
Copyright © 1986 by Xerox Corporation. All rights reserved.
Last edited by Bier on June 5, 1987 2:02:43 pm PDT
Contents: Routines for maintaining various storage pools in Solidviews and synchronizing their use. Synchronization is the main reason for the existence of this module. It provides a MONITOR lock for each storage pool.
DIRECTORY
SVStoragePools;
SVStoragePoolsImpl:
CEDAR
MONITOR LOCKS pool
USING pool: StoragePool
EXPORTS SVStoragePools =
BEGIN
MakeStorageProc: TYPE = SVStoragePools.MakeStorageProc;
InitializePoolProc: TYPE = SVStoragePools.InitializePoolProc;
AllocateProc: TYPE = SVStoragePools.AllocateProc;
FreeProc: TYPE = SVStoragePools.FreeProc;
StoragePoolClass: TYPE = REF StoragePoolClassObj;
StoragePoolClassObj: TYPE = SVStoragePools.StoragePoolClassObj;
StoragePool: TYPE = REF StoragePoolObj;
StoragePoolObj: TYPE = SVStoragePools.StoragePoolObj;
CreateClass:
PUBLIC PROC [name:
ATOM, init: InitializePoolProc, allocate: AllocateProc, free: FreeProc]
RETURNS [class: StoragePoolClass] = {
class ← NEW[StoragePoolClassObj ← [name, init, allocate, free]];
};
CreatePool:
PUBLIC PROC [class: StoragePoolClass, makeStorage: MakeStorageProc]
RETURNS [pool: StoragePool] = {
Creates a new pool and runs its initialize proc.
pool ← NEW[StoragePoolObj ← [class: class, data: NIL]];
pool.class.init[pool];
Initialize:
PUBLIC ENTRY PROC [pool: StoragePool] = {
Re-initializes the pool.
pool.class.init[pool];
};
Allocate:
PUBLIC ENTRY PROC [pool: StoragePool]
RETURNS [item:
REF
ANY] = {
item ← pool.class.allocate[pool];
};
Free:
PUBLIC ENTRY PROC [pool: StoragePool, item:
REF
ANY] = {
pool.class.free[pool, item];
};
END.