showthread

The showthread program displays the thread activity of a Modula-3 program.

Normally, you should not start showthread directly. Rather, the runtime will start showthread and feed it with the proper data when the argument @M3showthread is given to a Modula-3 program; for example, to run the program foo and see the threads of that process, type:

    foo @M3showthread
A Trestle window will appear; when you click the start button, the program foo will actually start.

Each thread in the program will be given a vertical track in the showthread window, in which the successive states of the thread will be displayed, using color patches. After the thread dies, the track can be reused for another thread.

Each time the scheduler decides to stop the currently running thread and makes a decision about what to do next, showthread will add a new row of color patches to show the state of all the threads.

The legend in the showthread window indicates which color is used for which state:

   - running:  currently running
   - alive:    can run, but is not currently running
   - waiting:  waiting for a condition to be signaled
   - locking:  waiting for a mutex to be released
   - pausing:  pausing for some time (via Thread.Pause)
   - blocking: waiting for I/O activity (via SchedulerPosix.IOWait)
   - dying:    the thread returned, but nobody joined it yet