Scheme 48 Manual | Contents | In Chapter: Command processor
Previous: Resource query and control | Next: Quite obscure

## Threads

Each command level has its own set of threads. These threads are suspended when a new level is entered and resumed when the owning level again becomes the current level. A thread that raises an error is not resumed unless explicitly restarted using the `,proceed` command. In addition to any threads spawned by the user, each level has a thread that runs the command processor on that level. A new command-processor thread is started if the current one dies or is terminated. When a command level is abandoned for a lower level, or when a level is restarted using `,reset`, all of the threads on that level are terminated and any `dynamic-wind` "after" thunks are run.

The following commands are useful when debugging multithreaded programs:

  `,threads`
  Invokes the inspector on a list of the threads running at the next lower command level.

  `,exit-when-done [`exp`]`
  Waits until all user threads have completed and then exits back out to shell (or executive or whatever invoked Scheme 48 in the first place). `Exp` should evaluate to an integer which is then returned to the calling program.

Previous: Resource query and control | Next: Quite obscure