MonitoredQueue.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
written by Paxton. December 1981
last written by Paxton. August 9, 1982 1:19 pm
Last Edited by: Maxwell, January 5, 1983 12:34 pm
Michael Plass, March 14, 1985 10:00:32 am PST
Doug Wyatt, March 3, 1985 4:48:59 pm PST
MonitoredQueue: CEDAR DEFINITIONS
= BEGIN
MQ: TYPE = REF QueueBody;
QueueBody: TYPE;
Create: PROC RETURNS [MQ];
creates a new queue
Add: PROC [item: REF ANY, queue: MQ];
adds item to queue
causes ERROR QueueClosed if queue is closed
AddToSet: PROC [item: REF ANY, queue: MQ];
adds item to queue unless it is already in it
causes ERROR QueueClosed if queue is closed
QueueClosed: ERROR;
EndOfQueue: ERROR;
Remove: PROC [queue: MQ] RETURNS [REF ANY];
returns next item
will wait for next item to be added if queue has not been closed
causes ERROR EndOfQueue if have called Close[queue] and no more items
Close: PROC [queue: MQ];
to indicate that will not be adding any more items to MQ
Reset: PROC [queue: MQ];
this waits until queue is closed and empty, then reopens it
END.