<> <> <> 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, <> < the action completed (returning results)>> < the action raised ERROR ABORTED>> < debugCount > 0>> < the process is running (we hope)>> 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]; <<(process = NIL => check self)>> <> <<>> Join: PROC [process: Process, wait: BOOL _ TRUE] RETURNS [status: Status, results: REF]; <>> <> <> Abort: PROC [process: Process]; <> <> CheckAbort: PROC [process: Process _ NIL]; <<(process = NIL => check self)>> <> <> <<(OR if Process.CheckForAbort raises ABORTED)>> <> GetBusyList: PROC RETURNS [ProcessList]; <> GetBusyCount: PROC RETURNS [INT]; <> }.