internal IndependentTimer GetTimer(DateTime time) { if (_timers.ContainsKey(time)) { var cached = _timers[time].Target as IndependentTimer; if (cached != null) { return(cached); } } if (2 * _purgePressure >= _timers.Count) { foreach (var key in _timers.Keys.ToList()) { if (!_timers[key].IsAlive) { _timers.Remove(key); } } _purgePressure = 0; } var created = new IndependentTimer(this, time); _timers[time] = new WeakReference(created); ++_purgePressure; return(created); }
protected override int GetComponent(int component, TimeSpan cut, TimeSpan increment) { var next = Snapshot >= TimeSpan.Zero ? cut + increment : (-cut) + TimeSpan.FromTicks(1); IndependentTimer.Get(_zone, _zero + next).OnGet(); IndependentTimer.Get(_zone, _zero + next - increment).OnGet(); return(component); }
T GetComponent <T>(T component, DateTime prev, DateTime next) { IndependentTimer.Get(_zone, prev).OnGet(); IndependentTimer.Get(_zone, next).OnGet(); return(component); }
IndependentTimer GetTimer(DateTime comparand) { return(IndependentTimer.Get(_zone, comparand - _delta)); }
internal void Dequeue(IndependentTimer timer) { _forth.Remove(timer); _back.Remove(timer); }
internal void Enqueue(IndependentTimer timer, bool expired) { (expired ? _back : _forth).Add(timer); ScheduleNext(); }
IndependentTimer GetTimer(TimeSpan comparand) { return(IndependentTimer.Get(_zone, _zero + comparand)); }
internal IndependentTimer GetTimer(DateTime time) { if (_timers.ContainsKey(time)) { var cached = _timers[time].Target as IndependentTimer; if (cached != null) return cached; } if (2 * _purgePressure >= _timers.Count) { foreach (var key in _timers.Keys.ToList()) if (!_timers[key].IsAlive) _timers.Remove(key); _purgePressure = 0; } var created = new IndependentTimer(this, time); _timers[time] = new WeakReference(created); ++_purgePressure; return created; }