ThreadPool

  • Thread starter Thread starter Thore Berntsen
  • Start date Start date
T

Thore Berntsen

Is there any way I can get how many threads that are running in the
threadpool?

Thore Berntsen
 
While debugging you can check out the number of threads with the remote
tools of eVC... Subtract 3+x where x is the number of threads you explicitly
create.. Also subtract 1 if you have any finalisers that have run.. The
remainder number is the number of Threading.Timer threads created (which the
ThreadPool is based on in CF 1.0)...

In CF 2.0 you will also be able to view the number of threadpool threads in
the mscoree.stat file when turning Performance Counters on...

Programmatically there isn't a managed way (since the
ThreadPool.GetXXXTreads methods are missing) but you might have some luck by
iterating the threads in your process and performing the subtractions I
detailed further above... I know there is some article (don't have the link
right now) for iterating processes using toolhelp.dll maybe that is a good
starter...

Cheers
Daniel
 
Back
Top