public void replace(T key, DateTime time, Action action) { lock (timers) { LogC.verbose(() => "TR (" + identity() + "): " + key + " for:" + ymdHuman(time)); remove(key); add(key, time, action); } }
public void add(T key, DateTime time, Action action) { lock (timers) { LogC.verbose(() => "T+ (" + identity() + "): " + key + " for:" + ymdHuman(time)); Bomb.existing(timers, key); Timer timer; timerManager().atTime(time, () => { lock (timers) timers.Remove(key); action(); }, out timer); timers[key] = timer; } }
public bool clear() { var removedOne = false; lock (timers) { LogC.verbose(() => "T! (" + identity() + ")"); each(item => removedOne = removedOne || remove(item)); } return(removedOne); }
public bool remove(T key) { lock (timers) { Timer existing; if (timers.TryGetValue(key, out existing)) { LogC.verbose(() => "T- (" + identity() + "): " + key); existing.Dispose(); timers.Remove(key); return(true); } LogC.verbose(() => "T* (" + identity() + "): " + key); return(false); } }
public void initiate() { timerManager().everyMillis(waitMillis, publish, out timer); LogC.verbose(() => "initiated " + timer); }