-- Copyright (C) 1984 by Xerox Corporation. All rights reserved.
-- SLDefs.mesa Transport Mechanism Mail Server - public DEFS for SL queues
-- HGM: 10-Dec-84 21:52:36
-- Andrew Birrell September 13, 1982 3:36 pm --
-- Hankins 31-Jul-84 8:27:59 Klamath update (defs for SLRestart)
DIRECTORY
BodyDefs USING [Timestamp],
HeapDefs USING [ReaderHandle, WriterHandle],
ObjectDirDefs USING [ObjectNumber],
ServerDefs USING [ServerHandle],
VMDefs USING [pageSize, PageAddress];
SLDefs: DEFINITIONS =
BEGIN
-- General --
SLQueue: TYPE = {express, input, forward, pending, mailbox};
ItemIndex: TYPE = [0..VMDefs.pageSize / SIZE[Item]);
ItemAddress: TYPE = RECORD [page: VMDefs.PageAddress, item: ItemIndex];
Item: TYPE = MACHINE DEPENDENT RECORD [
body: ObjectDirDefs.ObjectNumber,
SL: ObjectDirDefs.ObjectNumber,
state: {free, full, reading} --2 bits-- ,
fill: [0..16383] --ugh! 14 bits-- ];
SLHeader: TYPE = MACHINE DEPENDENT RECORD [
created: BodyDefs.Timestamp,
received: BodyDefs.Timestamp,
server: ServerDefs.ServerHandle];
-- placed at start of each steering list --
-- Writer (single event) --
SLWrite: PROCEDURE [
body: ObjectDirDefs.ObjectNumber, SL: HeapDefs.WriterHandle, queue: SLQueue];
-- Adds a message, consisting of the data which has
-- previously been written on the given message body
-- and steering list, to the given queue. Increments
-- the reference count on the message body.
-- Subsequent use of this WriterHandle is illegal. --
-- Reader (many per queue) --
SLReadHandle: TYPE = ItemAddress;
WaitForNonEmpty: PROCEDURE [queue: SLQueue];
-- returns when the queue is non-empty --
GetCount: PROCEDURE [queue: SLQueue] RETURNS [CARDINAL];
-- returns the queue length, 0 if it's empty --
SLStartRead: PROCEDURE [queue: SLQueue]
RETURNS [
handle: SLReadHandle, body: ObjectDirDefs.ObjectNumber,
SL: HeapDefs.ReaderHandle];
-- Waits until the queue is non-empty.
-- Gives caller exclusive right to read the message
-- body and steering list of the next item in the
-- given queue. --
SLTransfer: PROCEDURE [handle: SLReadHandle, queue: SLQueue];
-- Abandons reading an item from a queue, and
-- transfers it from its present queue to the given
-- one. The caller is responsible for terminating
-- reading the associated steering list. Subsequent
-- use of this SLReadHandle is illegal. --
SLEndRead: PROCEDURE [handle: SLReadHandle];
-- Deletes the item from the queue. Decrements the
-- reference counts on the associated message body and
-- steering list. The caller is responsible for
-- terminating reading the associated steering list.
-- Subsequent use of this SLReadHandle is illegal. --
-- things for SLRestart use ONLY:
RestartQueues: PROCEDURE [initHeap: BOOLEAN];
END.