protected override async Task RunAsync(CancellationToken cancellationToken) { Trace.WriteLine("Starting Pi estimation."); Estimate next = Estimate.PI(null); while (true) { cancellationToken.ThrowIfCancellationRequested(); next = Estimate.PI(next); ServiceEventSource.Current.ServiceMessage(this, next.ToString()); await Task.Delay(TimeSpan.FromSeconds(1), cancellationToken); } }
protected override async Task RunAsync(CancellationToken cancellationToken) { Trace.WriteLine("Starting Pi estimation."); Estimate next = Estimate.PI(null); while (true) { cancellationToken.ThrowIfCancellationRequested(); next = Estimate.PI(next); Trace.WriteLine(next); await Task.Delay(TimeSpan.FromSeconds(1), cancellationToken); } }