public TimerEx(String name, bool isBackground) { if (name == null) { throw new NullReferenceException("name is null"); } this.impl = new TimerImpl(name, isBackground); this.disposal = new DisposeHelper(impl); }
public Timer periodic(TimeSpan duration, Action callback) { var timer = new TimerImpl(duration, callback, periodic: true); lock (this._queue) { this._queue.enqueue(timer); } return(timer); }
public Timer run(TimeSpan duration, Action callback) { var timer = new TimerImpl(duration, callback); lock (this._queue) { this._queue.enqueue(timer); } return(timer); }
public Timer runInMain(Action callback) { var timer = new TimerImpl(callback); lock (this._queue) { this._queue.enqueue(timer); } return(timer); }
protected override IDisposable Run(IObserver <long> observer, IDisposable cancel, Action <IDisposable> setSink) { if (_period.HasValue) { var sink = new TimerImpl(this, observer, cancel); setSink(sink); return(sink.Run()); } else { var sink = new _(this, observer, cancel); setSink(sink); return(sink.Run()); } }
public DisposeHelper(TimerImpl impl) { this.impl = impl; }