CedarProcess: CEDAR DEFINITIONS = { Priority: TYPE = MACHINE DEPENDENT { idle (0), -- not for client use; only Watch should use this priority background (1), -- good for non-interactive CPU users normal (2), -- good for most processes foreground (3), -- good for important processes excited (4), -- good for a few time-sensitive interactive processes faultHandlers (5), -- not for client use realTime (6), -- not normally for client use; normally for device control swatWatcher (7) -- not for client use; used by emergency debugger call }; ForkableProc: TYPE = PROC [data: REF] RETURNS [results: REF _ NIL]; ForkOptions: TYPE = RECORD [ priority: Priority _ normal, usePriority: BOOL _ FALSE, inheritProperties: BOOL _ FALSE ]; DefaultForkOptions: ForkOptions = []; Status: TYPE = {done, aborted, debugging, busy, invalid}; Process: TYPE = REF ProcessRep; ProcessList: TYPE = LIST OF Process; ProcessRep: TYPE = RECORD [ process: PROCESS _ NIL, action: ForkableProc _ NIL, data: REF _ NIL, results: REF _ NIL, status: Status _ busy, debugCount: INT _ 0, abortCount: INT _ 0, abortRequested: BOOL _ FALSE ]; SetPriority: PROC [priority: Priority]; GetPriority: PROC RETURNS [priority: Priority]; DoWithPriority: PROC [priority: Priority, action: PROC]; Fork: PROC [action: ForkableProc, data: REF _ NIL, options: ForkOptions _ DefaultForkOptions] RETURNS [Process]; GetStatus: PROC [process: Process _ NIL] RETURNS [Status]; Join: PROC [process: Process, wait: BOOL _ TRUE] RETURNS [status: Status, results: REF]; Abort: PROC [process: Process]; CheckAbort: PROC [process: Process _ NIL]; GetBusyList: PROC RETURNS [ProcessList]; GetBusyCount: PROC RETURNS [INT]; }. CedarProcess.mesa Copyright c 1985 by Xerox Corporation. All rights reserved. Russ Atkinson (RRA) June 7, 1985 2:14:03 pm PDT Types This definition of Priority must be numerically the same as the one in the Process interface. This type of procedure can be forked by the Fork operation. It takes the callback data and returns the results (if any) for the forked process. The priority to use if usePriority = TRUE IF FALSE, use the current priority IF TRUE, inherit the process properties (accessed through ProcessProps) These options are used by Fork. The current Mesa process behind this process. Not valid if status = done or status = aborted. The forked procedure for this process. The call back data for this process. The results (if any). Only valid if status = done. The status of the process. done => the action completed (returning results) aborted => the action raised ERROR ABORTED debugging => debugCount > 0 busy => the process is running (we hope) increments when AMEvents.Debugging occurs decrements when AMEvents.Debugged occurs increments when Abort is called set TRUE when Abort is called set FALSE when CheckAbort is called Operations for the current process Sets the priority of the current process to the given priority Gets the priority of the current process Performs the action using the given priority. After the action completes the priority reverts to the priority before the call. Operations for forked processes Forks the action with the given callback data and the given options. Note that the action must NOT be a nested procedure. (process = NIL => check self) Monitored access to process.status. wait = TRUE AND (process.status = debugging OR process.status = busy) => wait for (process.status = done OR process.status = aborted) In all other cases, return the current results and status. a monitored call to make process.abortRequested = TRUE increments process.abortCount (process = NIL => check self) a monitored call to make process.abortRequested = TRUE raises ERROR ABORTED if process.abortRequested was TRUE when called (OR if Process.CheckForAbort raises ABORTED) Operations for all busy forked processes Returns a copy of the current busy list of processes. Returns the number of processes forked through this interface that currently have status = busy or status = debugging. Κφ˜codešœ™Kšœ Οmœ1™™>K˜—š  œžœžœ˜/Kšœ(™(K™—š œžœžœ˜8Kšœ™K™——™K˜š  œžœžœžœ-žœ ˜pKšœ`žœ™zK™—š  œžœžœžœ ˜:Kšœ žœ™Kšœ#™#K™—š  œžœžœžœžœžœ˜Xšœžœžœžœ™HKšœ<™<—K™:—K˜š œžœ˜Kšœ2ž™6Kšœ™K˜—š  œžœžœ˜*Kšœ žœ™Kšœ2ž™6šœžœžœžœ ™CKšœžœ!žœ™,—K˜——™(K˜š  œžœžœ˜(Kšœ5™5—K˜š  œžœžœžœ˜!Kšœv™v——K˜K˜K˜—…—”¨