public TimerAction(ISchedulerRegistry registry, Action action, long firstIntervalInMs, long intervalInMs) { this._registry = registry; this._action = action; this._firstIntervalInMs = firstIntervalInMs; this._intervalInMs = intervalInMs; }
public TimerAction(ISchedulerRegistry scheduler, Action action, long firstIntervalInMs, long intervalInMs) { _scheduler = scheduler; _action = action; _firstIntervalInMs = firstIntervalInMs; _intervalInMs = intervalInMs; }
// Methods public void ExecuteOnTimerThread(ISchedulerRegistry registry) { if (_intervalInMs == Timeout.Infinite || _cancelled) { registry.Remove(this); if (_timer != null) { _timer.Dispose(); _timer = null; } } if (!_cancelled) { registry.Enqueue(ExecuteOnFiberThread); } }
public void ExecuteOnTimerThread(ISchedulerRegistry registry) { if (_intervalInMs == Timeout.Infinite || _cancelled) { registry.Remove(this); if (_timer != null) { _timer.Dispose(); _timer = null; } } if (!_cancelled) { registry.Enqueue(ExecuteOnFiberThread); } }
public void Schedule(ISchedulerRegistry registry) { _timer = new Timer(x => ExecuteOnTimerThread(registry), null, _firstIntervalInMs, _intervalInMs); }