Normally I heard that 25 threads are operating on ThreadPool.
When I execute the following :
namespace Examples.Delegates
{
public delegate void InvokerDelegate();
class Discussion
{
static void Main()
{
Discussion dis=new Discussion();
InvokerDelegate MethodInvoker=dis.Foo;
for(int i=1;i<=30;i++)
{
MethodInvoker.BeginInvoke(null,null);
}
Console.ReadKey(true);
}
private void Foo()
{
int avlThreads, avlToAsynThreads;
ThreadPool.GetAvailableThreads
(out avlThreads,out avlToAsynThreads);
string Message=string.
Format("From ThreadPool :{0} ,Thread Id :{1},Free Threads :{2}",
Thread.CurrentThread.IsThreadPoolThread,
Thread.CurrentThread.ManagedThreadId,
avlThreads);
Console.WriteLine(Message);
Thread.Sleep(1000);
return;
}
}
}
The third argument of string "Message" (i.e) avlThreads prints 490+ available threads.What is the correction should i need to do?