SVStoragePools.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.
SVStoragePools: CEDAR DEFINITIONS =
BEGIN
MakeStorageProc: TYPE = PROC [pool: StoragePool];
InitializePoolProc: TYPE = PROC [pool: StoragePool];
AllocateProc: TYPE = PROC [pool: StoragePool] RETURNS [item: REF ANY];
FreeProc: TYPE = PROC [pool: StoragePool, item: REF ANY];
StoragePoolClass: TYPE = REF StoragePoolClassObj;
StoragePoolClassObj:
TYPE =
RECORD [
name: ATOM,
init: InitializePoolProc,
allocate: AllocateProc,
free: FreeProc
];
StoragePool: TYPE = REF StoragePoolObj;
StoragePoolObj:
TYPE =
MONITORED RECORD [
class: StoragePoolClass,
data: REF ANY
];
CreateClass:
PROC [name:
ATOM, init: InitializePoolProc, allocate: AllocateProc, free: FreeProc]
RETURNS [class: StoragePoolClass];
CreatePool:
PROC [class: StoragePoolClass, makeStorage: MakeStorageProc]
RETURNS [pool: StoragePool];
Creates a new pool and allocates some storage for it.
Initialize:
PROC [pool: StoragePool];
Initializes the pool storage before using it.
Allocate: PROC [pool: StoragePool] RETURNS [item: REF ANY];
Free: PROC [pool: StoragePool, item: REF ANY];
END.