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

◆ WaitForSignal()

bool System.Threading.LowLevelLifoSemaphore.WaitForSignal ( int timeoutMs)
inlineprivate

Definition at line 279 of file LowLevelLifoSemaphore.cs.

280 {
281 _onWait();
282 Counts counts;
283 do
284 {
285 if (!WaitCore(timeoutMs))
286 {
288 return false;
289 }
290 counts = _separated._counts;
291 while (true)
292 {
293 Counts newCounts = counts;
294 if (counts.SignalCount != 0)
295 {
296 newCounts.DecrementSignalCount();
297 newCounts.DecrementWaiterCount();
298 }
299 if (counts.CountOfWaitersSignaledToWake != 0)
300 {
301 newCounts.DecrementCountOfWaitersSignaledToWake();
302 }
303 Counts counts2 = _separated._counts.InterlockedCompareExchange(newCounts, counts);
304 if (counts2 == counts)
305 {
306 break;
307 }
308 counts = counts2;
309 }
310 }
311 while (counts.SignalCount == 0);
312 return true;
313 }
Counts InterlockedCompareExchange(Counts newCounts, Counts oldCounts)

References System.Threading.LowLevelLifoSemaphore.CacheLineSeparatedCounts._counts, System.Threading.LowLevelLifoSemaphore._onWait, System.Threading.LowLevelLifoSemaphore._separated, System.Threading.LowLevelLifoSemaphore.Counts.CountOfWaitersSignaledToWake, System.Threading.LowLevelLifoSemaphore.Counts.DecrementCountOfWaitersSignaledToWake(), System.Threading.LowLevelLifoSemaphore.Counts.DecrementSignalCount(), System.Threading.LowLevelLifoSemaphore.Counts.DecrementWaiterCount(), System.Threading.LowLevelLifoSemaphore.Counts.InterlockedCompareExchange(), System.Threading.LowLevelLifoSemaphore.Counts.InterlockedDecrementWaiterCount(), System.Threading.LowLevelLifoSemaphore.Counts.SignalCount, and System.Threading.LowLevelLifoSemaphore.WaitCore().

Referenced by System.Threading.LowLevelLifoSemaphore.Wait().