Main Site Documentation

Can you see current Threads running in vs?


#1

Is there a way in VS2010 that i can see all current running threads ?
Say i have 3 Threads, like below i want to know if they are running or not.


new Thread(Thread_1).Start();
new Thread(Thread_2).Start();
new Thread(Thread_3).Start();


private void Thread1()
{
    while(true)
    {
        if(problem)
            break;

        Thread.Sleep(100);    
    }
}

private void Thread2()
{
    while(true)
    {
        if(problem)
            break;

        Thread.Sleep(100);    
    }
}

private void Thread3()
{
    while(true)
    {
        if(problem)
            break;

        Thread.Sleep(100);    
    }
}


#2

You can use Debug.Print inside the loop or outside. If it is outside that will indicate that the thread is done.


#3

But no way in VS to see running threads ?


#4

There is Threads window.


#5

is that in the express version or only the full ? I dont see it.


#6

Sorry, don’t have express version. Try documentation.


#7

Guess that explain’s then why i don’t see it :wink:

http://msdn.microsoft.com/en-us/library/w15yf86f.aspx


#8

I you have a handle to the thread object for the thread you could find find out if the thread is still running. The details are left to the reader.


#9

In VS2010, you select Debug -> Windows -> Threads or press Ctrl - Alt - H. Please note it is NOT available in VS 2010 Express version. Hope that is what you mean.