diff options
Diffstat (limited to 'src/vm/win32threadpool.cpp')
-rw-r--r-- | src/vm/win32threadpool.cpp | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/vm/win32threadpool.cpp b/src/vm/win32threadpool.cpp index 1121417492..e8a05c383f 100644 --- a/src/vm/win32threadpool.cpp +++ b/src/vm/win32threadpool.cpp @@ -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()); @@ -2367,11 +2369,11 @@ Work: counts = oldCounts; } - if (GCHeap::IsGCInProgress(TRUE)) + if (GCHeapUtilities::IsGCInProgress(TRUE)) { // GC is imminent, so wait until GC is complete before executing next request. // this reduces in-flight objects allocated right before GC, easing the GC's work - GCHeap::WaitForGCCompletion(TRUE); + GCHeapUtilities::WaitForGCCompletion(TRUE); } { @@ -3677,6 +3679,8 @@ DWORD __stdcall ThreadpoolMgr::CompletionPortThreadStart(LPVOID lpArgs) BOOL fThreadInit = FALSE; Thread *pThread = NULL; + DWORD cpThreadWait = 0; + if (g_fEEStarted) { pThread = SetupThreadNoThrow(); if (pThread == NULL) { @@ -3711,7 +3715,7 @@ DWORD __stdcall ThreadpoolMgr::CompletionPortThreadStart(LPVOID lpArgs) ThreadCounter::Counts oldCounts; ThreadCounter::Counts newCounts; - DWORD cpThreadWait = CP_THREAD_WAIT; + cpThreadWait = CP_THREAD_WAIT; for (;; ) { Top: @@ -3986,7 +3990,7 @@ Top: if (key != 0) { - if (GCHeap::IsGCInProgress(TRUE)) + if (GCHeapUtilities::IsGCInProgress(TRUE)) { //Indicate that this thread is free, and waiting on GC, not doing any user work. //This helps in threads not getting injected when some threads have woken up from the @@ -4003,7 +4007,7 @@ Top: // GC is imminent, so wait until GC is complete before executing next request. // this reduces in-flight objects allocated right before GC, easing the GC's work - GCHeap::WaitForGCCompletion(TRUE); + GCHeapUtilities::WaitForGCCompletion(TRUE); while (true) { @@ -4217,7 +4221,7 @@ BOOL ThreadpoolMgr::ShouldGrowCompletionPortThreadpool(ThreadCounter::Counts cou if (counts.NumWorking >= counts.NumActive && NumCPInfrastructureThreads == 0 - && (counts.NumActive == 0 || !GCHeap::IsGCInProgress(TRUE)) + && (counts.NumActive == 0 || !GCHeapUtilities::IsGCInProgress(TRUE)) ) { // adjust limit if neeeded @@ -4618,7 +4622,7 @@ DWORD __stdcall ThreadpoolMgr::GateThreadStart(LPVOID lpArgs) EX_END_CATCH(SwallowAllExceptions); } - if (!GCHeap::IsGCInProgress(FALSE) ) + if (!GCHeapUtilities::IsGCInProgress(FALSE) ) { if (IgnoreNextSample) { @@ -4660,7 +4664,7 @@ DWORD __stdcall ThreadpoolMgr::GateThreadStart(LPVOID lpArgs) oldCounts.NumActive < MaxLimitTotalCPThreads && !g_fCompletionPortDrainNeeded && NumCPInfrastructureThreads == 0 && // infrastructure threads count as "to be free as needed" - !GCHeap::IsGCInProgress(TRUE)) + !GCHeapUtilities::IsGCInProgress(TRUE)) { BOOL status; |