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

◆ GetOrCreateQueue()

static Queue System.Net.TimerThread.GetOrCreateQueue ( int durationMilliseconds)
inlinestaticpackage

Definition at line 339 of file TimerThread.cs.

340 {
341 if (durationMilliseconds == -1)
342 {
343 return new InfiniteTimerQueue();
344 }
345 if (durationMilliseconds < 0)
346 {
347 throw new ArgumentOutOfRangeException("durationMilliseconds");
348 }
349 object key = durationMilliseconds;
350 WeakReference weakReference = (WeakReference)s_queuesCache[key];
352 if (weakReference == null || (timerQueue = (TimerQueue)weakReference.Target) == null)
353 {
355 {
356 weakReference = (WeakReference)s_queuesCache[key];
357 if (weakReference == null || (timerQueue = (TimerQueue)weakReference.Target) == null)
358 {
360 weakReference = new WeakReference(timerQueue);
361 s_newQueues.AddLast(weakReference);
363 if (++s_cacheScanIteration % 32 == 0)
364 {
367 while (enumerator.MoveNext())
368 {
370 if (((WeakReference)entry.Value).Target == null)
371 {
372 list.Add(entry.Key);
373 }
374 }
375 for (int i = 0; i < list.Count; i++)
376 {
377 s_queuesCache.Remove(list[i]);
378 }
379 }
380 }
381 }
382 }
383 return timerQueue;
384 }
static readonly Hashtable s_queuesCache
static int s_cacheScanIteration
static readonly LinkedList< WeakReference > s_newQueues

References System.key, System.list, System.Net.TimerThread.s_cacheScanIteration, System.Net.TimerThread.s_newQueues, and System.Net.TimerThread.s_queuesCache.