* New version of IRM New version of the IRM, updated to Medley. * moved to docs/medley-irm as discussed
663 lines
63 KiB
Plaintext
663 lines
63 KiB
Plaintext
1
|
||
|
||
Interlisp-D Reference Manual
|
||
1
|
||
|
||
Interlisp-D Reference Manual
|
||
23. PROCESSES
|
||
1
|
||
|
||
23. PROCESSES
|
||
1
|
||
|
||
|
||
|
||
"23"23. PROCESSES
|
||
6
|
||
|
||
The Interlisp-D Process mechanism provides an environment in which multiple Lisp processes can run in parallel. Each executes in its own stack space, but all share a global address space. The current process implementation is cooperative; i.e., process switches happen voluntarily, either when the process in control has nothing to do or when it is in a convenient place to pause. There is no preemption or guaranteed service, so you cannot run something demanding (e.g., Chat) at the same time as something that runs for long periods without yielding control. Keyboard input and network operations block with great frequency, so processes currently work best for highly interactive tasks (editing, making remote files).
|
||
In Interlisp-D, the process mechanism is already turned on, and is expected to stay on during normal operations, as some system facilities (in particular, most network operations) require it. However, under exceptional conditions, the following function can be used to turn the world off and on:
|
||
(PROCESSWORLD(PROCESSWORLD (Function) NIL NIL ("23") 1) FLG) [Function]
|
||
Starts up the process world, or if FLG = OFF, kills all processes and turns it off. Normally does not return. The environment starts out with two processes: a top-level EVALQT (the initial "tty" process) and the "background" process, which runs the window mouse handler and other system background tasks.
|
||
PROCESSWORLD is intended to be called at the top level of Interlisp, not from within a program. It does not toggle some sort of switch; rather, it constructs some new processes in a new part of the stack, leaving any callers of PROCESSWORLD in a now inaccessible part of the stack. Calling (PROCESSWORLD 'OFF) is the only way the call to PROCESSWORLD ever returns.
|
||
(HARDRESET(HARDRESET (Function) NIL NIL ("23") 1)) [Function]
|
||
Resets the whole world, and rebuilds the stack from scratch. This is "harder" than doing RESET to every process, because it also resets system internal processes (such as the keyboard handler).
|
||
HARDRESET automatically turns the process world on (or resets it if it was on), unless the variable AUTOPROCESSFLG is NIL.
|
||
Creating and Destroying Processes
|
||
1
|
||
|
||
(ADD.PROCESS(ADD.PROCESS (Function) NIL NIL ("23") 1) FORM PROP1 VALUE1 ... PROPN VALUEN) [NoSpread Function]
|
||
Creates a new process evaluating FORM, and returns its process handle. The process's stack environment is the top level, i.e., the new process does not have access to the environment in which ADD.PROCESS was called; all such information must be passed as arguments in FORM. The process runs until FORM returns or the process is explicitly deleted. An untrapped error within the process also deletes the process (unless its RESTARTABLE property is T), in which case a message is printed to that effect.
|
||
The remaining arguments are alternately property names and values. Any property/value pairs acceptable to PROCESSPROP may be given, but the following two are directly relevant to ADD.PROCESS:
|
||
NAME Value should be a litatom; if not given, the process name is taken from (CAR FORM). ADD.PROCESS may pack the name with a number to make it unique. This name is solely for the convenience of manipulating processes at Lisp typein; e.g., the name can be given as the PROC argument to most process functions, and the name appears in menus of processes. However, programs should normally only deal in process handles, both for efficiency and to avoid the confusion that can result if two processes have the same defining form.
|
||
SUSPEND If the value is non-NIL, the new process is created but then immediately suspended; i.e., the process does not actually run until woken by a WAKE.PROCESS (below).
|
||
(PROCESSPROP(PROCESSPROP (Function) NIL NIL ("23") 2) PROC PROP NEWVALUE) [NoSpread Function]
|
||
Used to get or set the values of certain properties of process PROC, in a manner analogous to WINDOWPROP. If NEWVALUE is supplied (including if it is NIL), property PROP is given that value. In all cases, returns the old value of the property. The following properties have special meaning for processes; all others are uninterpreted:
|
||
NAME Value is a litatom used for identifying the process to the user.
|
||
FORM Value is the Lisp form used to start the process (readonly).
|
||
RESTARTABLE Value is a flag indicating the disposition of the process following errors or hard resets:
|
||
NIL or NO (the default): If an untrapped error (or Control-E or Control-D) causes its form to be exited, the process is deleted. The process is also deleted if a HARDRESET (or Control-D from RAID) occurs, causing the entire Process world to be reinitialized.
|
||
T or YES: The process is automatically restarted on errors or HARDRESET. This is the normal setting for persistent "background" processes, such as the mouse process, that can safely restart themselves on errors.
|
||
HARDRESET: The process is deleted as usual if an error causes its form to be exited, but it is restarted on a HARDRESET. This setting is preferred for persistent processes for which an error is an unusual condition, one that might repeat itself if the process were simply blindly restarted.
|
||
RESTARTFORM If the value is non-NIL, it is the form used if the process is restarted (instead of the value of the FORM property). Of course, the process must also have a non-NIL RESTARTABLE prop for this to have any effect.
|
||
BEFOREEXIT If the value is the atom DON'T, it will not be interrupted by a LOGOUT. If LOGOUT is attempted before the process finishes, a message will appear saying that Interlisp is waiting for the process to finish. If you want the LOGOUT to proceed without waiting, you must use the process status window (from the background menu) to delete the process.
|
||
AFTEREXIT Value indicates the disposition of the process following a resumption of Lisp after some exit (LOGOUT, SYSOUT, MAKESYS). Possible values are:
|
||
DELETE: Delete the process.
|
||
SUSPEND: Suspend the process; i.e., do not let it run until it is explicitly woken.
|
||
An event: Cause the process to be suspended waiting for the event (See the Events section below).
|
||
INFOHOOK Value is a function or form used to provide information about the process, in conjunction with the INFO command in the process status window (see the Process Status Window section below).
|
||
WINDOW Value is a window associated with the process, the process's "main" window. Used to switch the tty process to this process when you click in this window (see the Switching the TTY Process section below).
|
||
Setting the WINDOW property does not set the primary I/O stream (NIL) or the terminal I/O stream (T) to the window. When a process is created, I/O operations to the NIL or T stream will cause a new window to appear. TTYDISPLAYSTREAM (see Chapter 28) should be used to set the terminal i/o stream of a process to a specific window.
|
||
TTYENTRYFN Value is a function that is applied to the process when the process is made the tty process (see the Switching the TTY Process section below).
|
||
TTYEXITFN Value is a function that is applied to the process when the process ceases to be the tty process (see the Switching the TTY Process section below).
|
||
(THIS.PROCESS(THIS.PROCESS (Function) NIL NIL ("23") 3)) [Function]
|
||
Returns the handle of the currently running process, or NIL if the Process world is turned off.<2E><> |