From 4be1b4b90f17418e5784a269cc5214efe24a5afa Mon Sep 17 00:00:00 2001 From: Koundinya Veluri Date: Sat, 4 Nov 2017 19:01:39 -0700 Subject: Limit min threads in thread pool to 1 (#14864) Related to https://github.com/dotnet/coreclr/issues/14239 --- src/vm/win32threadpool.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/vm/win32threadpool.cpp') diff --git a/src/vm/win32threadpool.cpp b/src/vm/win32threadpool.cpp index 4210060755..34097feca7 100644 --- a/src/vm/win32threadpool.cpp +++ b/src/vm/win32threadpool.cpp @@ -617,7 +617,7 @@ BOOL ThreadpoolMgr::SetMinThreads(DWORD MinWorkerThreads, if (GetForceMinWorkerThreadsValue() == 0) { - MinLimitTotalWorkerThreads = min(MinWorkerThreads, (DWORD)ThreadCounter::MaxPossibleCount); + MinLimitTotalWorkerThreads = max(1, min(MinWorkerThreads, (DWORD)ThreadCounter::MaxPossibleCount)); ThreadCounter::Counts counts = WorkerCounter.GetCleanCounts(); while (counts.MaxWorking < MinLimitTotalWorkerThreads) @@ -647,7 +647,7 @@ BOOL ThreadpoolMgr::SetMinThreads(DWORD MinWorkerThreads, END_SO_INTOLERANT_CODE; - MinLimitTotalCPThreads = min(MinIOCompletionThreads, (DWORD)ThreadCounter::MaxPossibleCount); + MinLimitTotalCPThreads = max(1, min(MinIOCompletionThreads, (DWORD)ThreadCounter::MaxPossibleCount)); init_result = TRUE; } -- cgit v1.2.3