_ASSERTE(!CLRThreadpoolHosted());
- ThreadCounter::Counts counts = WorkerCounter.GetCleanCounts();
+ // counts volatile read paired with CompareExchangeCounts loop set
+ ThreadCounter::Counts counts = WorkerCounter.DangerousGetDirtyCounts();
ThreadCounter::Counts newCounts;
while (true)
{
// Of course, there's no guarantee *that* will work - but hopefully enough time will have passed
// to allow whoever's using all the memory right now to release some.
//
- counts = WorkerCounter.GetCleanCounts();
+
+ // counts volatile read paired with CompareExchangeCounts loop set
+ counts = WorkerCounter.DangerousGetDirtyCounts();
while (true)
{
//
ThreadCounter::Counts counts, oldCounts, newCounts;
bool foundWork = true, wasNotRecalled = true;
- counts = WorkerCounter.GetCleanCounts();
+ // counts only used for Etw event
+ counts = WorkerCounter.DangerousGetDirtyCounts();
FireEtwThreadPoolWorkerThreadStart(counts.NumActive, counts.NumRetired, GetClrInstanceId());
#ifdef FEATURE_COMINTEROP
#ifdef FEATURE_COMINTEROP
if (pThread->SetApartment(Thread::AS_InMTA, TRUE) != Thread::AS_InMTA)
{
- counts = WorkerCounter.GetCleanCounts();
+ // counts volatile read paired with CompareExchangeCounts loop set
+ counts = WorkerCounter.DangerousGetDirtyCounts();
while (true)
{
newCounts = counts;
// make sure there's really work. If not, go back to sleep
- counts = WorkerCounter.GetCleanCounts();
+ // counts volatile read paired with CompareExchangeCounts loop set
+ counts = WorkerCounter.DangerousGetDirtyCounts();
while (true)
{
_ASSERTE(counts.NumActive > 0);
Retire:
- counts = WorkerCounter.GetCleanCounts();
+ // counts only used for Etw event
+ counts = WorkerCounter.DangerousGetDirtyCounts();
FireEtwThreadPoolWorkerThreadRetirementStart(counts.NumActive, counts.NumRetired, GetClrInstanceId());
// It's possible that some work came in just before we decremented the active thread count, in which
if (WAIT_OBJECT_0 == result)
{
foundWork = true;
- counts = WorkerCounter.GetCleanCounts();
+
+ // counts only used for Etw event
+ counts = WorkerCounter.DangerousGetDirtyCounts();
FireEtwThreadPoolWorkerThreadRetirementStop(counts.NumActive, counts.NumRetired, GetClrInstanceId());
goto Work;
}
// if we don't hit zero, then there's another retired thread that will pick up this signal. So it's ok
// to exit.
//
- counts = WorkerCounter.GetCleanCounts();
+
+ // counts volatile read paired with CompareExchangeCounts loop set
+ counts = WorkerCounter.DangerousGetDirtyCounts();
while (true)
{
if (counts.NumRetired == 0)
DangerousNonHostedSpinLockHolder tal(&ThreadAdjustmentLock);
- counts = WorkerCounter.GetCleanCounts();
+ // counts volatile read paired with CompareExchangeCounts loop set
+ counts = WorkerCounter.DangerousGetDirtyCounts();
while (true)
{
if (counts.NumActive == counts.NumWorking)
_ASSERTE(!IsIoPending());
- counts = WorkerCounter.GetCleanCounts();
+ // counts only used for Etw event
+ counts = WorkerCounter.DangerousGetDirtyCounts();
FireEtwThreadPoolWorkerThreadStop(counts.NumActive, counts.NumRetired, GetClrInstanceId());
return ERROR_SUCCESS;