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

◆ FireNextTimers()

void System.Threading.TimerQueue.FireNextTimers ( )
inlineprivate

Definition at line 167 of file TimerQueue.cs.

168 {
169 TimerQueueTimer timerQueueTimer = null;
170 lock (this)
171 {
172 _isTimerScheduled = false;
173 bool flag = false;
174 uint num = uint.MaxValue;
175 long tickCount = TickCount64;
176 TimerQueueTimer timerQueueTimer2 = _shortTimers;
177 for (int i = 0; i < 2; i++)
178 {
179 while (timerQueueTimer2 != null)
180 {
181 TimerQueueTimer next = timerQueueTimer2._next;
182 long num2 = tickCount - timerQueueTimer2._startTicks;
183 long num3 = timerQueueTimer2._dueTime - num2;
184 if (num3 <= 0)
185 {
186 timerQueueTimer2._everQueued = true;
187 if (timerQueueTimer2._period != uint.MaxValue)
188 {
189 timerQueueTimer2._startTicks = tickCount;
190 long num4 = num2 - timerQueueTimer2._dueTime;
191 timerQueueTimer2._dueTime = ((num4 >= timerQueueTimer2._period) ? 1u : (timerQueueTimer2._period - (uint)(int)num4));
192 if (timerQueueTimer2._dueTime < num)
193 {
194 flag = true;
195 num = timerQueueTimer2._dueTime;
196 }
197 bool flag2 = tickCount + timerQueueTimer2._dueTime - _currentAbsoluteThreshold <= 0;
198 if (timerQueueTimer2._short != flag2)
199 {
201 }
202 }
203 else
204 {
206 }
207 if (timerQueueTimer == null)
208 {
210 }
211 else
212 {
213 ThreadPool.UnsafeQueueUserWorkItemInternal(timerQueueTimer2, preferLocal: false);
214 }
215 }
216 else
217 {
218 if (num3 < num)
219 {
220 flag = true;
221 num = (uint)num3;
222 }
223 if (!timerQueueTimer2._short && num3 <= 333)
224 {
226 }
227 }
228 timerQueueTimer2 = next;
229 }
230 if (i != 0)
231 {
232 continue;
233 }
234 long num5 = _currentAbsoluteThreshold - tickCount;
235 if (num5 > 0)
236 {
237 if (_shortTimers == null && _longTimers != null)
238 {
239 num = (uint)((int)num5 + 1);
240 flag = true;
241 }
242 break;
243 }
245 _currentAbsoluteThreshold = tickCount + 333;
246 }
247 if (flag)
248 {
250 }
251 }
252 timerQueueTimer?.Fire();
253 }
void MoveTimerToCorrectList(TimerQueueTimer timer, bool shortList)
TimerQueueTimer _shortTimers
Definition TimerQueue.cs:51
TimerQueueTimer _longTimers
Definition TimerQueue.cs:53
bool EnsureTimerFiresBy(uint requestedDuration)
void DeleteTimer(TimerQueueTimer timer)

References System.Threading.TimerQueue._currentAbsoluteThreshold, System.Threading.TimerQueue._isTimerScheduled, System.Threading.TimerQueue._longTimers, System.Threading.TimerQueue._shortTimers, System.Threading.TimerQueue.DeleteTimer(), System.Threading.TimerQueue.EnsureTimerFiresBy(), System.Threading.TimerQueue.MoveTimerToCorrectList(), System.Threading.TimerQueue.TickCount64, and System.Threading.ThreadPool.UnsafeQueueUserWorkItemInternal().