title: Active Thread Number in Thread Pool
body: <p>When I write the below code, why do I get avaliable Thread number like 1022, 1020.
  I have to get 25 thread max as I am using thread pool. </p>
  
  <p>I guess the ouput thread number is the avaliable threads on the system. I need to get the avaliable thread number in my thread pool, in win form application.</p>
  
  <pre><code>private void Foo()
  {
      int intAvailableThreads, intAvailableIoAsynThreds;
  
      // ask the number of avaialbe threads on the pool,
      //we really only care about the first parameter.
      ThreadPool.GetAvailableThreads(out intAvailableThreads,
          out intAvailableIoAsynThreds);
  
      // build a message to log
      string strMessage =
          String.Format(@"Is Thread Pool: {1},
              Thread Id: {2} Free Threads {3}",
              Thread.CurrentThread.IsThreadPoolThread.ToString(),
              Thread.CurrentThread.GetHashCode(),
              intAvailableThreads);
  
      // check if the thread is on the thread pool.
      Trace.WriteLine(strMessage);
  
      // create a delay...
      Thread.Sleep(30000);
  
      return;
  }
  </code></pre>
  
  <p>Thanks alot..</p>
  
  <p>(Note : I got the code from <a href="http://www.codeproject.com/KB/cs/AsyncMethodInvocation.aspx" rel="noreferrer">http://www.codeproject.com/KB/cs/AsyncMethodInvocation.aspx</a>)
  Nice article!!</p>