Ejemplo n.º 1
0
 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);
     }
 }
Ejemplo n.º 2
0
 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;
     }
 }
Ejemplo n.º 3
0
        public bool clear()
        {
            var removedOne = false;

            lock (timers) {
                LogC.verbose(() => "T! (" + identity() + ")");
                each(item => removedOne = removedOne || remove(item));
            }
            return(removedOne);
        }
Ejemplo n.º 4
0
 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);
     }
 }
Ejemplo n.º 5
0
 public void initiate()
 {
     timerManager().everyMillis(waitMillis, publish, out timer);
     LogC.verbose(() => "initiated " + timer);
 }