I am working on Parallel processing project. One of the tasks is getting the number of threads for the current running process.
I am using this method:
private void timer1_Tick(object sender, EventArgs e)
{
label1.Text = Process.GetCurrentProcess().Threads.Count.ToString();
}
But it gives me a very strange result, which is (13) !!, however I have only one thread which is the UIThread and it should be (1) and I have not created any extra threads yet..
Can anyone explain that result for me? Any help is appreciated
Every .NET application creates and maintains Thread Pool by default. You can limit it's size via ThreadPool.SetMaxThread method, but you must understand consequences of it.