Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>That's not the number of spawned threads. That's the number of additional threads that could be spawned before the maximum is reached.</p> <p>MSDN: <a href="http://msdn.microsoft.com/en-us/library/system.threading.threadpool.getavailablethreads.aspx" rel="nofollow">ThreadPool.GetAvailableThreads Method</a></p> <p>GetMaxThreads minus GetAvailableThreads is probably the number you are looking for.</p> <p>Without doing anything:</p> <pre><code>class Program { static void Main(string[] args) { int workerThreads, completionPortThreads; ThreadPool.GetAvailableThreads(out workerThreads, out completionPortThreads); Console.WriteLine(workerThreads); Console.WriteLine(completionPortThreads); Console.ReadLine(); } } </code></pre> <p>The output is:</p> <pre><code>1023 1000 </code></pre> <p>If you make sure to call ThreadPool.GetAvailableThreads while you know some of your threads are still working, the number should be lower.</p> <p>Example:</p> <pre><code> static void Main(string[] args) { int workerThreads, completionPortThreads; ThreadPool.GetAvailableThreads(out workerThreads, out completionPortThreads); Console.WriteLine(workerThreads); Console.WriteLine(completionPortThreads); Console.WriteLine(); ThreadPool.QueueUserWorkItem(o =&gt; Thread.Sleep(10000)); ThreadPool.GetAvailableThreads(out workerThreads, out completionPortThreads); Console.WriteLine(workerThreads); Console.WriteLine(completionPortThreads); Console.ReadLine(); } </code></pre> <p>The output is:</p> <pre><code>1023 1000 1022 1000 </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload