tags:

views:

222

answers:

2

How do I determine which are the foreground .NET threads from WinDBG ? Using the !threads command the SOS extenstion tells us the count of the foreground threads but not which ones.

+2  A: 

The state flag in the !threads output holds a lot of information. If the 0x00000200 flag is set the thread is a background thread.

In SOS for .NET 4 and PSSCOR2, there's a !threadstate command, that will list the texts for a given flag value. If you don't have that, there's an overview of the flags in the rotor source code and in Debugging .NET 2.0 applications by John Robbins.

Brian Rasmussen
Thanks a lot! It will be nice to see all the thread state flags from the SOS extension.
Costel
+3  A: 

You can use the thread state values given in this link and find out if a thread is a background thread or not.

TS_Background 0x00000200 Thread is a background thread

hakan
+1 Didn't know that link. Thanks.
Brian Rasmussen