Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Remove CLRThreadpoolHosted as it always returns false. #9899

Merged
merged 1 commit into from Mar 2, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 5 additions & 11 deletions src/vm/threadpoolrequest.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down
6 changes: 0 additions & 6 deletions src/vm/util.hpp
Expand Up @@ -708,12 +708,6 @@ inline BOOL CLRSyncHosted()
return FALSE;
}

inline BOOL CLRThreadpoolHosted()
{
LIMITED_METHOD_CONTRACT;
return FALSE;
}

inline BOOL CLRIoCompletionHosted()
{
LIMITED_METHOD_CONTRACT;
Expand Down
21 changes: 6 additions & 15 deletions src/vm/win32threadpool.cpp
Expand Up @@ -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.
Expand Down Expand Up @@ -1001,7 +999,6 @@ void ThreadpoolMgr::AdjustMaxWorkersActive()
}
CONTRACTL_END;

_ASSERTE(!CLRThreadpoolHosted());
_ASSERTE(ThreadAdjustmentLock.IsHeld());

DWORD currentTicks = GetTickCount();
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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();

//
Expand Down Expand Up @@ -2067,8 +2061,6 @@ DWORD __stdcall ThreadpoolMgr::WorkerThreadStart(LPVOID lpArgs)
}
CONTRACTL_END;

_ASSERTE(!CLRThreadpoolHosted());

Thread *pThread = NULL;
DWORD dwSwitchCount = 0;
BOOL fThreadInit = FALSE;
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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())
{
Expand Down
10 changes: 2 additions & 8 deletions src/vm/win32threadpool.h
Expand Up @@ -1122,20 +1122,14 @@ class ThreadpoolMgr
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;
Expand Down