Scheme 48 Manual | Contents | In Chapter: Threads
Previous: Debugging multithreaded programs | Next: Debugging multithreaded programs

## Debugging multithreaded programs

Debugging multithreaded programs can be difficult.

As described here, when any thread signals an error, Scheme 48 stops running all of the threads at that command level.

The following procedure (exported by the structure `debug-messages`) is useful in debugging multi-threaded programs.

- `(debug-message element0 ...)`

`Debug-message` prints the elements to ``stderr`', followed by a newline. The only types of values that `debug-message` prints in full are small integers (fixnums), strings, characters, symbols, booleans, and the empty list. Values of other types are abbreviated as follows:

> pair | `(...)`
> vector | `#(...)`
> procedure | `#{procedure}`
> record | `#{<name of record type>}`
> all others | `???`

The great thing about `debug-message` is that it bypasses Scheme 48's I/O and thread handling. The message appears immediately, with no delays or errors.

Previous: Debugging multithreaded programs | Next: Debugging multithreaded programs