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

◆ RemoveParticipants()

void System.Threading.Barrier.RemoveParticipants ( int participantCount)
inline

Definition at line 168 of file Barrier.cs.

169 {
171 if (participantCount < 1)
172 {
173 throw new ArgumentOutOfRangeException("participantCount", participantCount, System.SR.Barrier_RemoveParticipants_NonPositive_ArgumentOutOfRange);
174 }
175 if (_actionCallerID != 0 && Environment.CurrentManagedThreadId == _actionCallerID)
176 {
178 }
179 SpinWait spinWait = default(SpinWait);
180 while (true)
181 {
182 int currentTotalCount = _currentTotalCount;
183 GetCurrentTotal(currentTotalCount, out var current, out var total, out var sense);
184 if (total < participantCount)
185 {
186 throw new ArgumentOutOfRangeException("participantCount", System.SR.Barrier_RemoveParticipants_ArgumentOutOfRange);
187 }
188 if (total - participantCount < current)
189 {
191 }
192 int num = total - participantCount;
193 if (num > 0 && current == num)
194 {
195 if (SetCurrentTotal(currentTotalCount, 0, total - participantCount, !sense))
196 {
197 FinishPhase(sense);
198 break;
199 }
200 }
201 else if (SetCurrentTotal(currentTotalCount, current, total - participantCount, sense))
202 {
203 break;
204 }
205 spinWait.SpinOnce(-1);
206 }
207 }
static string Barrier_InvalidOperation_CalledFromPHA
Definition SR.cs:34
static string Barrier_RemoveParticipants_NonPositive_ArgumentOutOfRange
Definition SR.cs:32
static string Barrier_RemoveParticipants_InvalidOperation
Definition SR.cs:28
static string Barrier_RemoveParticipants_ArgumentOutOfRange
Definition SR.cs:30
Definition SR.cs:7
void FinishPhase(bool observedSense)
Definition Barrier.cs:342
void GetCurrentTotal(int currentTotal, out int current, out int total, out bool sense)
Definition Barrier.cs:76
bool SetCurrentTotal(int currentTotal, int current, int total, bool sense)
Definition Barrier.cs:83
volatile int _currentTotalCount
Definition Barrier.cs:9

References System.Threading.Barrier._actionCallerID, System.Threading.Barrier._currentTotalCount, System.SR.Barrier_InvalidOperation_CalledFromPHA, System.SR.Barrier_RemoveParticipants_ArgumentOutOfRange, System.SR.Barrier_RemoveParticipants_InvalidOperation, System.SR.Barrier_RemoveParticipants_NonPositive_ArgumentOutOfRange, System.Environment.CurrentManagedThreadId, System.Threading.Barrier.FinishPhase(), System.Threading.Barrier.GetCurrentTotal(), System.Threading.Barrier.SetCurrentTotal(), System.Threading.SpinWait.SpinOnce(), and System.Threading.Barrier.ThrowIfDisposed().

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