Exemplo n.º 1
0
        public void Reset()
        {
            endTime = TimeNow + timeOut;

            lock (Watchdogs)
            {
                Watchdogs.Sort((w1, w2) => w1.endTime - w2.endTime);
            }
        }
Exemplo n.º 2
0
 public void Dispose()
 {
     if (isActive)
     {
         lock (Watchdogs)
         {
             Watchdogs.Remove(this);
         }
         isActive = false;
     }
 }
Exemplo n.º 3
0
        public Watchdog(Action onTimeout, int timeoutSec)
        {
            timeOut   = timeoutSec;
            endTime   = TimeNow + timeOut;
            OnTimeout = onTimeout;

            lock (Watchdogs)
            {
                Watchdogs.Add(this);
            }

            Reset();
        }