NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Using the Threads Window

To display the Threads window

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. A program can be single threaded or multithreaded. On single-processor systems, only one thread can be actively running at a time — this is called the active thread.

When you debug a multithreaded program, you can use the Threads window to view thread information and manipulate threads. From the Threads window, you can set the active thread and freeze or thaw the execution of a thread. Freezing prevents the execution of a thread and thawing allows it. "Frozen" and "thawed" are states set by the debugger, and are independent of the Suspend count, which is set by the program.

To set an active thread

To freeze (prevent execution of) a thread

To thaw (allow execution of) a thread

In some cases, the debugger can freeze a thread without your specifically requesting it. If you select the Break command while your program is deadlocked in the kernel, the debugger will timeout after a few seconds and perform a "soft break." The debugger freezes all threads. A "soft break" resembles a normal break, but stepping is not possible. A message box informs you when a soft break occurs.

Tips for Debugging Threads

Tip   When debugging native Win32 code, you can view the contents of the Thread Information Block by entering the pseudoregister @TIB in the Watch window or QuickWatch dialog. For information on Thread Information Blocks, see "Under the Hood" in the May 1996 edition of the Microsoft Systems Journal.
Tip   When debugging native Win32 code, you can view the last error code for the current thread (the value returned by a call to (GetLastError) by entering the pseudoregister @Err in the Watch window or QuickWatch dialog.
Tip   For an example showing how to use CRT functions for debugging a multithreaded application, see the code in the CRT topic _malloc_dbg.

See Also

Threads Window | Inspecting Your Program