RefQueue.Mesa
A starving man's LIFO queue
Used to implement the Cedar object finalization mechanism
last edited August 2, 1983 7:11 pm by Paul Rovner
RefQueue:
DEFINITIONS =
BEGIN
Types
Queue: TYPE = REF Object;
Object: TYPE;
Procedures
New:
PROC[nEntries:
NAT ← 10]
RETURNS[Queue];
NO ALLOCATION is done by Enqueue, which is called by the collector
Enqueue:
PROC[queue: Queue, ref:
REF
ANY]
RETURNS[full:
BOOL];
result TRUE => ref was not placed on queue
Dequeue:
PROC[queue: Queue]
RETURNS[ref:
REF
ANY];
WAITs if queue is empty
IsEmpty: PROC[queue: Queue] RETURNS[BOOL];
IsFull: PROC[queue: Queue] RETURNS[BOOL];
END.