Fix ThreadPool.SetMaxThreads to not allow having zero available threads (dotnet/corec...
authorKoundinya Veluri <kouvel@microsoft.com>
Wed, 23 Nov 2016 03:14:13 +0000 (19:14 -0800)
committerGitHub <noreply@github.com>
Wed, 23 Nov 2016 03:14:13 +0000 (19:14 -0800)
There is an assertion checking for this, so allowing zero is probably not intentional.

Related to dotnet/coreclr#8236

Commit migrated from https://github.com/dotnet/coreclr/commit/74015760d85127bdda68a520d2c0fe5f8bb667ed

src/coreclr/src/vm/win32threadpool.cpp

index 1b4a869..98c7d3e 100644 (file)
@@ -532,7 +532,9 @@ BOOL ThreadpoolMgr::SetMaxThreadsHelper(DWORD MaxWorkerThreads,
     CrstHolder csh(&WorkerCriticalSection);
 
     if (MaxWorkerThreads >= (DWORD)MinLimitTotalWorkerThreads &&
-       MaxIOCompletionThreads >= (DWORD)MinLimitTotalCPThreads)
+        MaxIOCompletionThreads >= (DWORD)MinLimitTotalCPThreads &&
+        MaxWorkerThreads != 0 &&
+        MaxIOCompletionThreads != 0)
     {
         BEGIN_SO_INTOLERANT_CODE(GetThread());