internal ObservableTimer GetTimer(DateTime time) { if (_timers.ContainsKey(time)) { var cached = _timers[time].Target as ObservableTimer; 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 ObservableTimer(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); ObservableTimer.Get(_zone, _zero - next).OnGet(); ObservableTimer.Get(_zone, _zero - next - increment).OnGet(); return(component); }
T GetComponent <T>(T component, DateTime prev, DateTime next) { ObservableTimer.Get(_zone, prev).OnGet(); ObservableTimer.Get(_zone, next).OnGet(); return(component); }
ObservableTimer GetTimer(DateTime comparand) { return(ObservableTimer.Get(_zone, comparand - _delta)); }
ObservableTimer GetTimer(TimeSpan comparand) { return(ObservableTimer.Get(_zone, _zero - comparand)); }
internal void Dequeue(ObservableTimer timer) { _forth.Remove(timer); _back.Remove(timer); }
internal void Enqueue(ObservableTimer timer, bool expired) { (expired ? _back : _forth).Add(timer); ScheduleNext(); }
internal ObservableTimer GetTimer(DateTime time) { if (_timers.ContainsKey(time)) { var cached = _timers[time].Target as ObservableTimer; 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 ObservableTimer(this, time); _timers[time] = new WeakReference(created); ++_purgePressure; return created; }