File: StagePoolImpl.mesa
Last edited by Ousterhout, April 16, 1985 11:39:10 am PST
DIRECTORY
Globals,
StagePool;
StagePoolImpl: CEDAR PROGRAM
EXPORTS StagePool = {
OPEN Globals;
The variable below points to the first in a list of free stages. The stages are linked by their prev pointers.
freeList: Stage ← NIL;
New: PUBLIC PROC[] RETURNS [stage: Stage] = {
IF freeList # NIL THEN {
stage ← freeList;
freeList ← freeList.prev;
}
ELSE stage ← NEW[StageRec];
};
Free: PUBLIC PROC[stage: Stage] = {
stage.prev ← freeList;
freeList ← stage;
};
}.