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