DIRECTORY ; GGStoragePools: CEDAR DEFINITIONS = BEGIN MakeStorageProc: 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, allocate: AllocateProc, free: FreeProc ]; StoragePool: TYPE = REF StoragePoolObj; StoragePoolObj: TYPE = MONITORED RECORD [ class: StoragePoolClass, data: REF ANY ]; CreateClass: PROC [name: ATOM, allocate: AllocateProc, free: FreeProc] RETURNS [class: StoragePoolClass]; CreatePool: PROC [class: StoragePoolClass, makeStorage: MakeStorageProc] RETURNS [pool: StoragePool]; Allocate: PROC [pool: StoragePool] RETURNS [item: REF ANY]; Free: PROC [pool: StoragePool, item: REF ANY]; END. ÚGGStoragePools.mesa Contents: Routines for maintaining various storage pools and synchronizing their use. Synchronization is the main reason for the existence of this module. It provides a MONITOR lock for each storage pool. Copyright c 1988 by Xerox Corporation. All rights reserved. Bier, June 5, 1987 2:02:43 pm PDT allocate is called by Allocate. It returns one REF from the pool to the caller. allocate is also a good place to initialize fields in the REF. free is called by Free. It allows the caller to return one REF to the pool, when the caller is done with it. Creates a new pool and allows makeStorage to allocate some number of REFs to serve as the pool contents. calls pool.allocate. calls pool.free. ʼ˜J˜Icodešœ™šÏnœ¤Ïkœ™ÏKšœ Ïmœ1™