MonitoredQueue.Mesa
written by Paxton. December 1981
last written by Paxton. July 8, 1983 2:22 pm
Last Edited by: Maxwell, January 5, 1983 12:34 pm
MonitoredQueue: CEDAR DEFINITIONS =
BEGIN
MQ: TYPE = REF QueueBody;
QueueBody: TYPE;
Create:
PROC
RETURNS [
MQ];
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, 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.