ThreadCounter::Counts counts, oldCounts, newCounts;
bool foundWork = true, wasNotRecalled = true;
- // counts only used for Etw event
- counts = WorkerCounter.DangerousGetDirtyCounts();
+ counts = WorkerCounter.GetCleanCounts();
FireEtwThreadPoolWorkerThreadStart(counts.NumActive, counts.NumRetired, GetClrInstanceId());
#ifdef FEATURE_COMINTEROP
Retire:
- // counts only used for Etw event
- counts = WorkerCounter.DangerousGetDirtyCounts();
+ counts = WorkerCounter.GetCleanCounts();
FireEtwThreadPoolWorkerThreadRetirementStart(counts.NumActive, counts.NumRetired, GetClrInstanceId());
// It's possible that some work came in just before we decremented the active thread count, in which
{
foundWork = true;
- // counts only used for Etw event
- counts = WorkerCounter.DangerousGetDirtyCounts();
+ counts = WorkerCounter.GetCleanCounts();
FireEtwThreadPoolWorkerThreadRetirementStop(counts.NumActive, counts.NumRetired, GetClrInstanceId());
goto Work;
}
_ASSERTE(!IsIoPending());
- // counts only used for Etw event
- counts = WorkerCounter.DangerousGetDirtyCounts();
+ counts = WorkerCounter.GetCleanCounts();
FireEtwThreadPoolWorkerThreadStop(counts.NumActive, counts.NumRetired, GetClrInstanceId());
return ERROR_SUCCESS;
// and the state of the rest of the IOCP threads, we need to figure out whether to de-activate (exit) this thread, retire this thread,
// or transition to "working."
//
- oldCounts = CPThreadCounter.GetCleanCounts();
+
+ // counts volatile read paired with CompareExchangeCounts loop set
+ oldCounts = CPThreadCounter.DangerousGetDirtyCounts();
newCounts = oldCounts;
enterRetirement = false;
// We can now exit; decrement the retired count.
while (true)
{
- oldCounts = CPThreadCounter.GetCleanCounts();
+ // counts volatile read paired with CompareExchangeCounts loop set
+ oldCounts = CPThreadCounter.DangerousGetDirtyCounts();
newCounts = oldCounts;
newCounts.NumRetired--;
if (oldCounts == CPThreadCounter.CompareExchangeCounts(newCounts, oldCounts))
// put back into rotation -- we need a thread
while (true)
{
- oldCounts = CPThreadCounter.GetCleanCounts();
+ // counts volatile read paired with CompareExchangeCounts loop set
+ oldCounts = CPThreadCounter.DangerousGetDirtyCounts();
newCounts = oldCounts;
newCounts.NumRetired--;
newCounts.NumActive++;
//GC event, and some have not.
while (true)
{
- oldCounts = CPThreadCounter.GetCleanCounts();
+ // counts volatile read paired with CompareExchangeCounts loop set
+ oldCounts = CPThreadCounter.DangerousGetDirtyCounts();
newCounts = oldCounts;
newCounts.NumWorking--;
if (oldCounts == CPThreadCounter.CompareExchangeCounts(newCounts, oldCounts))
while (true)
{
- oldCounts = CPThreadCounter.GetCleanCounts();
+ // counts volatile read paired with CompareExchangeCounts loop set
+ oldCounts = CPThreadCounter.DangerousGetDirtyCounts();
newCounts = oldCounts;
newCounts.NumWorking++;
if (oldCounts == CPThreadCounter.CompareExchangeCounts(newCounts, oldCounts))
// if thread creation failed, we have to adjust the counts back down.
while (true)
{
- oldCounts = CPThreadCounter.GetCleanCounts();
+ // counts volatile read paired with CompareExchangeCounts loop set
+ oldCounts = CPThreadCounter.DangerousGetDirtyCounts();
newCounts = oldCounts;
newCounts.NumActive--;
newCounts.NumWorking--;
// IOCP threads are created as "active" and "working"
while (true)
{
- oldCounts = CPThreadCounter.GetCleanCounts();
+ // counts volatile read paired with CompareExchangeCounts loop set
+ oldCounts = CPThreadCounter.DangerousGetDirtyCounts();
newCounts = oldCounts;
newCounts.NumActive++;
newCounts.NumWorking++;