All the threads created in the current session are displayed in the Threads window. You can open the Threads window by choosing Window > Debugging > Threads (Alt-Shift-7).
Only one thread is the current thread at any given time. By default, the current thread is the thread within the current session from which the debugger gained control. When you switch between threads to debug, the Call Stack and Local Variables windows are automatically updated to reflect the data applicable to that thread.
To change the current thread:
You can suspend execution of a thread if you think it is causing problems and then later resume the thread once the problem is solved.
In the Threads window, the icon to the left of the thread name indicates whether the thread is suspended or waiting to be resumed.
Icon | Description |
---|---|
![]() |
Indicates the current thread |
![]() |
Indicates a thread that is running and is not current |
![]() |
Indicates a thread that is suspended and is not current |
You can display the Suspend property as a boolean flag (True or False)
in the Threads window by clicking the columns button
() and select the Suspend checkbox.
To suspend or resume a thread:
When debugging a multi-threaded application, a step in a particular thread may be interrupted by a breakpoint encountered in some other thread. This behavior is desirable in some cases but not in others.
Let us suppose you are stepping through a thread (thread 1), and one of the steps is interrupted by a breakpoint encountered in another thread (thread 2). When this happens, the program counter is set to the breakpoint in thread 2.
You can continue stepping through your program in the following ways:
To continue with the step in thread 1, do one of the following in the Threads window:
You can view the source code of a thread in the IDE's Source Editor if you think it is causing problems and want to examine it further.
To view a thread's source:
If the source of the thread is available, the Source Editor jumps to the current call on the thread's call stack.