Using the Thread Bar

Access

In the Cosmo Code main window above the Source panel when an applet or application is running. An icon for each thread is visible.

Purpose

For each thread in the program, the Thread bar contains a button that consists of an icon followed by a thread name. The Thread bar displays threads spawned by standard JavaTM class libraries as well as threads you have explicitly created. For example, if you write an applet that does not explicitly create a thread, you will see a number of threads with names like Awt-Motif or Screen Updater-3 created by classes that you use in your applet.

Thread buttons display the following information:

Note: If your program manually suspends or resumes threads, the thread bar does not reflect these changes in thread status.

At any point while a program is running, one thread is the current thread. When a thread is the current thread, you can suspend, resume, or stop the thread. The cards and commands in the debugging cards (Breakpoints, Callstack, and Data cards) apply to the current thread. With one exception, you control which thread is current by clicking on a thread button to make it the current thread. The exception is breakpoints. If an existing current thread is running and a breakpoint is encountered in another thread, that thread automatically becomes the current thread.

Click the right mouse button on a thread icon to view the thread name or ID and to display a menu with the following options:

Menu Item Description
Switch Makes the selected thread the current thread.
Suspend/Resume Suspends a thread or resumes a suspended thread.
Hide/Show Label Hides or shows the label for the thread icon.
Set Label... Allows you to specify a label name for a thread. The default label shows either the thread name (if a name is specified in the source code) or a system generated thread name such as Thread-7.
Note: The Thread bar displays thread names, not thread IDs. If you do not explicitly name a thread when you create it, a system-generated name such as Thread-7 is used (although the thread ID for this thread might be 9). Status messages and command-line output display both the thread name and the thread ID.

Guide to the Cosmo Code Development Environment
12-96*285