SlackProcessExtras.mesa
Copyright © 1990 by Xerox Corporation. All rights reserved.
Bier, April 3, 1991 4:52 pm PST
Contents: Routines for finer control of the process that dequeues and executes actions.
DIRECTORY
Process, SlackProcess, SlackProcessTypes;
SlackProcessExtras:
CEDAR
DEFINITIONS =
BEGIN
ActionProc: TYPE = SlackProcess.ActionProc;
SlackHandle: TYPE = SlackProcess.SlackHandle;
Pause:
PROC [handle: SlackHandle];
Request that the dequeuing process stop as soon as it has finished its current action (if any).
Continue:
PROC [handle: SlackHandle];
Cancels a pause request, allowing the dequeuing process to resume processing actions.
PauseRequested:
PROC [handle: SlackHandle]
RETURNS [
BOOL];
Returns TRUE if Pause has been called on this handle since the last Create or Continue was performed on this handle.
ProcessIsBusy:
PROC [handle: SlackHandle]
RETURNS [
BOOL];
RETURNS TRUE if the dequeuing process associated with handle is currently active.
HasPaused:
PROC [handle: SlackHandle]
RETURNS [
BOOL] =
INLINE {
RETURN[PauseRequested[handle] AND (NOT ProcessIsBusy[handle])];
};
WaitUntilPaused:
PROC [handle: SlackHandle, timeoutTicks: Process.Ticks ←
LAST[
CARD32]]
RETURNS [success:
BOOL ←
TRUE];
Causes the calling process to wait on a condition variable until the dequeuing process has stopped processing actions. If no pause has been requested, we wait anyway hoping another process will request one. If timeoutTicks = LAST[CARD32], always waits for the pause. Otherwise, if no pause occurs in timeoutTicks ticks, returns success = FALSE.
ProcessState: TYPE = {paused, idle, timeout};
WaitUntilPausedOrIdle:
PROC [handle: SlackHandle, timeoutTicks: Process.Ticks ←
LAST[
CARD32]]
RETURNS [state: ProcessState];
Causes the calling process to wait on a condition variable until the dequeuing process has stopped processing actions. If timeoutTicks = LAST[CARD32], always waits for pause or idle. Otherwise, if no pause or idle occurs in timeoutTicks ticks, returns state = timeout.
QueueReadOnly:
PROC [handle: SlackHandle, callBack: ActionProc, inputAction:
REF, clientData:
REF, optimizeHint:
REF, priority: Process.Priority ←
LAST[
CARD32]];
Like SlackProcess.QueueAction but marks this action as one that will only read data structures, not modify them.
QueueOrTimeout:
PROC [handle: SlackHandle, callBack: ActionProc, inputAction:
REF, clientData:
REF, optimizeHint:
REF, timeoutTicks: Process.Ticks, priority: Process.Priority ←
LAST[
CARD32]]
RETURNS [success:
BOOL ←
TRUE];
Like SlackProcess.QueueAction, but includes a timeout. If the action cannot be queued within this time period, the routine returns success = FALSE.
AllQueuedAreReadOnly:
PROC [handle: SlackHandle]
RETURNS [
BOOL];
Returns TRUE if all currently queued actions (including the currently active action, if any) were queued using QueueReadOnly.
InspectProc: TYPE = PROC [qeGen: SlackProcessTypes.QueueEntryGenerator, actionsOnQueue: NAT];
InspectQueue:
PROC [handle: SlackHandle, inspectProc: InspectProc];
Gives client a chance to inspect the queue at a time other than when the slack process is trying to decide what to do next (i.e., an InspectProc is much like an OptimizeProc).
END.