■ ThreadPool 클래스 : GetMinThreads 정적 메소드를 사용해 최소 스레드 수 설정하기

------------------------------------------------------------------------------------------------------------------------

using System;

using System.Threading;

 

int workerThreadCount, completionPortThreadCount;

 

ThreadPool.GetMinThreads(out workerThreadCount, out completionPortThreadCount);

 

Console.WriteLine("BEFORE UPDATE");

Console.WriteLine("--------------------------------------------------"           );

Console.WriteLine("WORKER THREAD COUNT          : {0}", workerThreadCount        );

Console.WriteLine("COMPLETION PORT THREAD COUNT : {0}", completionPortThreadCount);

Console.WriteLine("--------------------------------------------------"           );

 

Console.WriteLine();

 

ThreadPool.SetMinThreads(25, completionPortThreadCount);

 

ThreadPool.GetMinThreads(out workerThreadCount, out completionPortThreadCount);

 

Console.WriteLine("AFTER UPDATE");

Console.WriteLine("--------------------------------------------------"           );

Console.WriteLine("WORKER THREAD COUNT          : {0}", workerThreadCount        );

Console.WriteLine("COMPLETION PORT THREAD COUNT : {0}", completionPortThreadCount);

Console.WriteLine("--------------------------------------------------"           );

------------------------------------------------------------------------------------------------------------------------

Posted by 사용자 icodebroker