Share via


How to: Use the Threads Window 

This topic applies to:

Visual Studio Edition

Visual Basic

C#

C++

J#

Web Dev

Express Edition

No

No

No

No

No

Standard Edition

Hidden

Yes

Yes

Yes

Yes

Pro/Team Edition

Hidden

Yes

Yes

Yes

Yes

With the Threads window, you can examine and control threads in the program you are debugging. A thread is a sequence of executable instructions created by a program. By default, a program has a single thread. Multithreaded programs create additional threads. On a single CPU, one thread is active at a time. The active thread is the thread that is currently able to run.

From the Threads window, you can set the active thread. In addition, you can freeze or thaw the execution of each individual thread. Freezing prevents the execution of a thread. Thawing enables it to continue. Two vertical blue bars identify a frozen thread.

To display the Threads window in break mode or run mode

  • From the Debug menu, point to Windows, and then click Threads.

To set an active thread

  • In the Threads window, right-click a thread, and click Switch to Thread on the shortcut menu.

    -or-

    Double-click the thread to make it active.

    A yellow arrow identifies the active thread.

To freeze — prevent execution of — a thread

  • In the Threads window, right-click a thread, and click Freeze on the shortcut menu.

To thaw — allow execution of — a thread

  • In the Threads window, right-click a thread, and click Thaw on the shortcut menu.

    The absence of vertical blue bars identifies a thawed or unfrozen thread.

    You can suspend or resume thread execution using calls to SuspendThread and ResumeThread. In MFC, you can use CWinThread::SuspendThread and CWinThread::ResumeThread.

    These calls change the Suspend count shown in the Threads window. To execute, a thread must be unfrozen and have a Suspend count of zero. You cannot change the Suspend count or resume a suspended thread from the Threads window.

See Also

Concepts

Viewing Data in the Debugger
Tips for Debugging Threads