From: Austin Wise Date: Thu, 2 Mar 2017 09:28:56 +0000 (-0800) Subject: Remove CLRThreadpoolHosted as it always returns false. (dotnet/coreclr#9899) X-Git-Tag: submit/tizen/20210909.063632~11030^2~7880 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c292cfdcea9025dd6e6b5a982eb62864b3b0bc32;p=platform%2Fupstream%2Fdotnet%2Fruntime.git Remove CLRThreadpoolHosted as it always returns false. (dotnet/coreclr#9899) Commit migrated from https://github.com/dotnet/coreclr/commit/542ca8e3fe40dcea5c7c69bc20915ca41b8b3f97 --- diff --git a/src/coreclr/src/vm/threadpoolrequest.cpp b/src/coreclr/src/vm/threadpoolrequest.cpp index 7dee127..247deea 100644 --- a/src/coreclr/src/vm/threadpoolrequest.cpp +++ b/src/coreclr/src/vm/threadpoolrequest.cpp @@ -368,11 +368,8 @@ void UnManagedPerAppDomainTPCount::SetAppDomainRequestsActive() LONG prevCount = FastInterlockCompareExchange(&m_outstandingThreadRequestCount, count+1, count); if (prevCount == count) { - if (!CLRThreadpoolHosted()) - { - ThreadpoolMgr::MaybeAddWorkingWorker(); - ThreadpoolMgr::EnsureGateThreadRunning(); - } + ThreadpoolMgr::MaybeAddWorkingWorker(); + ThreadpoolMgr::EnsureGateThreadRunning(); break; } count = prevCount; @@ -608,11 +605,8 @@ void ManagedPerAppDomainTPCount::SetAppDomainRequestsActive() LONG prev = FastInterlockCompareExchange(&m_numRequestsPending, count+1, count); if (prev == count) { - if (!CLRThreadpoolHosted()) - { - ThreadpoolMgr::MaybeAddWorkingWorker(); - ThreadpoolMgr::EnsureGateThreadRunning(); - } + ThreadpoolMgr::MaybeAddWorkingWorker(); + ThreadpoolMgr::EnsureGateThreadRunning(); break; } count = prev; @@ -688,7 +682,7 @@ void ManagedPerAppDomainTPCount::ClearAppDomainUnloading() // AD. // VolatileStore(&m_numRequestsPending, (LONG)ThreadpoolMgr::NumberOfProcessors); - if (!CLRThreadpoolHosted() && ThreadpoolMgr::IsInitialized()) + if (ThreadpoolMgr::IsInitialized()) { ThreadpoolMgr::MaybeAddWorkingWorker(); ThreadpoolMgr::EnsureGateThreadRunning(); diff --git a/src/coreclr/src/vm/util.hpp b/src/coreclr/src/vm/util.hpp index 6380460..f4fcc06 100644 --- a/src/coreclr/src/vm/util.hpp +++ b/src/coreclr/src/vm/util.hpp @@ -708,12 +708,6 @@ inline BOOL CLRSyncHosted() return FALSE; } -inline BOOL CLRThreadpoolHosted() -{ - LIMITED_METHOD_CONTRACT; - return FALSE; -} - inline BOOL CLRIoCompletionHosted() { LIMITED_METHOD_CONTRACT; diff --git a/src/coreclr/src/vm/win32threadpool.cpp b/src/coreclr/src/vm/win32threadpool.cpp index ec42d5f..a4b4ca9 100644 --- a/src/coreclr/src/vm/win32threadpool.cpp +++ b/src/coreclr/src/vm/win32threadpool.cpp @@ -945,8 +945,6 @@ BOOL ThreadpoolMgr::QueueUserWorkItem(LPTHREAD_START_ROUTINE Function, bool ThreadpoolMgr::ShouldWorkerKeepRunning() { WRAPPER_NO_CONTRACT; - if (CLRThreadpoolHosted()) - return true; // // Maybe this thread should retire now. Let's see. @@ -1001,7 +999,6 @@ void ThreadpoolMgr::AdjustMaxWorkersActive() } CONTRACTL_END; - _ASSERTE(!CLRThreadpoolHosted()); _ASSERTE(ThreadAdjustmentLock.IsHeld()); DWORD currentTicks = GetTickCount(); @@ -1087,8 +1084,6 @@ void ThreadpoolMgr::MaybeAddWorkingWorker() } CONTRACTL_END; - _ASSERTE(!CLRThreadpoolHosted()); - // counts volatile read paired with CompareExchangeCounts loop set ThreadCounter::Counts counts = WorkerCounter.DangerousGetDirtyCounts(); ThreadCounter::Counts newCounts; @@ -1503,7 +1498,7 @@ void ThreadpoolMgr::EnsureGateThreadRunning() LIMITED_METHOD_CONTRACT; // The gate thread is only needed if the CLR is providing part of the ThreadPool implementation. - _ASSERTE(!CLRThreadpoolHosted() || !CLRIoCompletionHosted()); + _ASSERTE(!CLRIoCompletionHosted()); while (true) { @@ -1555,7 +1550,7 @@ bool ThreadpoolMgr::ShouldGateThreadKeepRunning() LIMITED_METHOD_CONTRACT; // The gate thread is only needed if the CLR is providing part of the ThreadPool implementation. - _ASSERTE(!CLRThreadpoolHosted() || !CLRIoCompletionHosted()); + _ASSERTE(!CLRIoCompletionHosted()); _ASSERTE(GateThreadStatus == GATE_THREAD_STATUS_WAITING_FOR_REQUEST || GateThreadStatus == GATE_THREAD_STATUS_REQUESTED); @@ -1584,8 +1579,7 @@ bool ThreadpoolMgr::ShouldGateThreadKeepRunning() // Are there any work requests in any worker queue? If so, we need a gate thread. // This imples that whenever a work queue goes from empty to non-empty, we need to call EnsureGateThreadRunning(). // - bool needGateThreadForWorkerThreads = - !CLRThreadpoolHosted() && + bool needGateThreadForWorkerThreads = PerAppDomainTPCountList::AreRequestsPendingInAnyAppDomains(); // @@ -2067,8 +2061,6 @@ DWORD __stdcall ThreadpoolMgr::WorkerThreadStart(LPVOID lpArgs) } CONTRACTL_END; - _ASSERTE(!CLRThreadpoolHosted()); - Thread *pThread = NULL; DWORD dwSwitchCount = 0; BOOL fThreadInit = FALSE; @@ -3334,7 +3326,7 @@ BOOL ThreadpoolMgr::CreateGateThread() LIMITED_METHOD_CONTRACT; // The gate thread is only needed if the CLR is providing part of the ThreadPool implementation. - _ASSERTE(!CLRThreadpoolHosted() || !CLRIoCompletionHosted()); + _ASSERTE(!CLRIoCompletionHosted()); HANDLE threadHandle = Thread::CreateUtilityThread(Thread::StackSize_Small, GateThreadStart, NULL); @@ -4305,7 +4297,7 @@ DWORD __stdcall ThreadpoolMgr::GateThreadStart(LPVOID lpArgs) CONTRACTL_END; // The gate thread is only needed if the CLR is providing part of the ThreadPool implementation. - _ASSERTE(!CLRThreadpoolHosted() || !CLRIoCompletionHosted()); + _ASSERTE(!CLRIoCompletionHosted()); _ASSERTE(GateThreadStatus == GATE_THREAD_STATUS_REQUESTED); @@ -4533,8 +4525,7 @@ DWORD __stdcall ThreadpoolMgr::GateThreadStart(LPVOID lpArgs) } #endif // !FEATURE_PAL - if (!CLRThreadpoolHosted() && - (0 == CLRConfig::GetConfigValue(CLRConfig::INTERNAL_ThreadPool_DisableStarvationDetection))) + if (0 == CLRConfig::GetConfigValue(CLRConfig::INTERNAL_ThreadPool_DisableStarvationDetection)) { if (PerAppDomainTPCountList::AreRequestsPendingInAnyAppDomains() && SufficientDelaySinceLastDequeue()) { diff --git a/src/coreclr/src/vm/win32threadpool.h b/src/coreclr/src/vm/win32threadpool.h index 13bca9f..60758af 100644 --- a/src/coreclr/src/vm/win32threadpool.h +++ b/src/coreclr/src/vm/win32threadpool.h @@ -1122,20 +1122,14 @@ public: static void NotifyWorkItemCompleted() { WRAPPER_NO_CONTRACT; - if (!CLRThreadpoolHosted()) - { - Thread::IncrementThreadPoolCompletionCount(); - UpdateLastDequeueTime(); - } + Thread::IncrementThreadPoolCompletionCount(); + UpdateLastDequeueTime(); } static bool ShouldAdjustMaxWorkersActive() { WRAPPER_NO_CONTRACT; - if (CLRThreadpoolHosted()) - return false; - DWORD priorTime = PriorCompletedWorkRequestsTime; MemoryBarrier(); // read fresh value for NextCompletedWorkRequestsTime below DWORD requiredInterval = NextCompletedWorkRequestsTime - priorTime;