Remove CLRThreadpoolHosted as it always returns false. (#9899)
authorAustin Wise <AustinWise@gmail.com>
Thu, 2 Mar 2017 09:28:56 +0000 (01:28 -0800)
committerJan Vorlicek <janvorli@microsoft.com>
Thu, 2 Mar 2017 09:28:56 +0000 (10:28 +0100)
src/vm/threadpoolrequest.cpp
src/vm/util.hpp
src/vm/win32threadpool.cpp
src/vm/win32threadpool.h

index 7dee127..247deea 100644 (file)
@@ -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();
index 6380460..f4fcc06 100644 (file)
@@ -708,12 +708,6 @@ inline BOOL CLRSyncHosted()
     return FALSE;
 }
 
-inline BOOL CLRThreadpoolHosted()
-{
-    LIMITED_METHOD_CONTRACT;
-    return FALSE;
-}
-
 inline BOOL CLRIoCompletionHosted()
 {
     LIMITED_METHOD_CONTRACT;
index ec42d5f..a4b4ca9 100644 (file)
@@ -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())
             {
index 13bca9f..60758af 100644 (file)
@@ -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;