Assembly: mscorlib (in mscorlib.dll)
'Declaration Public Shared Function SetMaxThreads ( _ workerThreads As Integer, _ completionPortThreads As Integer _ ) As Boolean 'Usage Dim workerThreads As Integer Dim completionPortThreads As Integer Dim returnValue As Boolean returnValue = ThreadPool.SetMaxThreads(workerThreads, completionPortThreads)
public static function SetMaxThreads ( workerThreads : int, completionPortThreads : int ) : boolean
The maximum number of worker threads in the thread pool.
The maximum number of asynchronous I/O threads in the thread pool.
Return Valuetrue if the change is successful; otherwise, false.
You cannot set the number of worker threads or the number of I/O completion threads to a number smaller than the number of processors in the computer.
If the common language runtime is hosted, for example by IIS or SQL Server, the host can limit or prevent changes to the thread pool size.
Use caution when changing the maximum number of threads in the thread pool. While your code might benefit, the changes might have an adverse effect on code libraries you use.
Setting the thread pool size too large can cause performance problems. If too many threads are executing at the same time, the task switching overhead becomes a significant factor.
Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows CE Platform Note: The maximum value that can be set is 1000.
Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.