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

◆ DiscontinuousWait()

bool System.Threading.Barrier.DiscontinuousWait ( ManualResetEventSlim currentPhaseEvent,
int totalTimeout,
CancellationToken token,
long observedPhase )
inlineprivate

Definition at line 410 of file Barrier.cs.

411 {
412 int num = 100;
413 int num2 = 10000;
414 while (observedPhase == CurrentPhaseNumber)
415 {
416 int num3 = ((totalTimeout == -1) ? num : Math.Min(num, totalTimeout));
417 if (currentPhaseEvent.Wait(num3, token))
418 {
419 return true;
420 }
421 if (totalTimeout != -1)
422 {
423 totalTimeout -= num3;
424 if (totalTimeout <= 0)
425 {
426 return false;
427 }
428 }
429 num = ((num >= num2) ? num2 : Math.Min(num << 1, num2));
430 }
431 WaitCurrentPhase(currentPhaseEvent, observedPhase);
432 return true;
433 }
void WaitCurrentPhase(ManualResetEventSlim currentPhaseEvent, long observedPhase)
Definition Barrier.cs:400

References System.Threading.Barrier.CurrentPhaseNumber, System.Math.Min(), System.Threading.ManualResetEventSlim.Wait(), and System.Threading.Barrier.WaitCurrentPhase().

Referenced by System.Threading.Barrier.SignalAndWait().