5.3 Debugging under multitasking

5.3.1 Understanding streams

Lisp receives input from and sends output to streams. The I/O system uses the streams that are the values of the Common Lisp variables*standard-input* and*standard-output* for standard communication. These streams are normally synonym streams for the stream contained in the variable*terminal-io*. As such, when you call the Common Lisp functionwrite-char, Lisp sends a character to the stream that is the value of*standard-output*, which forwards the character to the stream associated with*terminal-io*. When Lisp starts up, the stream found in*terminal-io* is the one that interacts with the controlling terminal.

Communication from inside the Debugger occurs through the stream that is the value of the Common Lisp variable*debug-io*. Interactions within the Debugger do not reset the values of the streams associated with *standard-input* and*standard-output*. Thus, if you invoke a function from the Debugger, output generated by that function is likely to be sent to the stream associated with *standard-output* rather than to the one associated with*debug-io*.

The Multitasking Facility uses the special stream stored in the variable *initial-io*, which contains the initial value of*terminal-io* by default. When the scheduler gets an internal error or when the Debugger is entered recursively, the Multitasking Facility prefers using the initial I/O stream; that is, it chooses to communicate by means of the stream contained in*initial-io* rather than by using the streams in*debug-io* or*terminal-io*. The macrousing-initial-io rebinds*terminal-io* to the value contained in*initial-io*; the standard input and output streams become synonyms for*terminal-io*. It also disables scheduling to ensure that all communication occurs through the initial I/O stream and that no other processes can run.


The Advanced User's Guide - 9 SEP 1996

Generated with Harlequin WebMaker