Hi Gunga,
To do this, you need to first import System.Diagnostic namespace, get the
current processes running on your machine and retrieve the total threadcounts
of each process.
See me code below,
using System.Diagnostics;
Process[] processList = Process.GetProcesses();
int threadCount = 0;
foreach (Process proc in processList)
{
threadCount = threadCount + proc.Threads.Count;
}
The threadCount gives you the final count of total number of active threads
on your machine...
Hope this helps!!
--
Thinathayalan Ganesan, MCAD
"Gunga Din" wrote:
> I must be missing it somehow...
>
> I need to count the number of threads running, not just those started by my
> application. Rather like the Task Manager, I would like to get the total
> number of threads that are active.
>
> What would be the most reliable way to obtain this number?
>
> Thanks!
>
>
>
|