Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ ShouldStopProcessingWorkNow()

static bool System.Threading.PortableThreadPool.WorkerThread.ShouldStopProcessingWorkNow ( PortableThreadPool threadPoolInstance)
inlinestaticpackage

Definition at line 1147 of file PortableThreadPool.cs.

1148 {
1149 ThreadCounts threadCounts = threadPoolInstance._separated.counts;
1150 while (true)
1151 {
1152 if (threadCounts.NumProcessingWork <= threadCounts.NumThreadsGoal)
1153 {
1154 return false;
1155 }
1156 ThreadCounts newCounts = threadCounts;
1157 newCounts.SubtractNumProcessingWork(1);
1158 ThreadCounts threadCounts2 = threadPoolInstance._separated.counts.InterlockedCompareExchange(newCounts, threadCounts);
1159 if (threadCounts2 == threadCounts)
1160 {
1161 break;
1162 }
1163 threadCounts = threadCounts2;
1164 }
1165 return true;
1166 }

References System.Threading.PortableThreadPool._separated, System.Threading.PortableThreadPool.CacheLineSeparated.counts, System.Threading.PortableThreadPool.ThreadCounts.InterlockedCompareExchange(), System.Threading.PortableThreadPool.ThreadCounts.NumProcessingWork, System.Threading.PortableThreadPool.ThreadCounts.NumThreadsGoal, and System.Threading.PortableThreadPool.ThreadCounts.SubtractNumProcessingWork().

Referenced by System.Threading.PortableThreadPool.NotifyWorkItemComplete().