private void StartCongestionControlTimer() { this.congestionControlTimer = this.timerPool.GetPooledTimer(this.congestionControllerDelayInSeconds); this.congestionControlTask = this.congestionControlTimer.StartTimerAsync().ContinueWith(async(task) => { await this.RunCongestionControlAsync(); }, this.cancellationTokenSource.Token); }
private void ResetTimer() { this.currentTimer = this.timerPool.GetPooledTimer(this.dispatchTimerInSeconds); this.timerTask = this.currentTimer.StartTimerAsync().ContinueWith((task) => { this.DispatchTimer(); }, this.cancellationTokenSource.Token); }
public void Dispose() { this.cancellationTokenSource.Cancel(); this.cancellationTokenSource.Dispose(); this.currentTimer.CancelTimer(); this.currentTimer = null; this.timerTask = null; }
public async Task TenK_WithPooledTimer() { TimerPool timerPool = new TimerPool(1); List <Task> timers = new List <Task>(this.timeouts.Count); for (int i = 0; i < this.timeouts.Count; i++) { PooledTimer timer = timerPool.GetPooledTimer(this.timeouts[i] / 1000); timers.Add(timer.StartTimerAsync()); } await Task.WhenAll(timers); timerPool.Dispose(); }
public void Dispose() { this.cancellationTokenSource.Cancel(); this.cancellationTokenSource.Dispose(); this.currentTimer.CancelTimer(); this.currentTimer = null; this.timerTask = null; if (this.congestionControlTimer != null) { this.congestionControlTimer.CancelTimer(); this.congestionControlTimer = null; this.congestionControlTask = null; } }
public async Task One_WithPooledTimer() { PooledTimer timer = this.timerPool.GetPooledTimer(1); await timer.StartTimerAsync(); }