Task flushingTask = null; public override Task FlushAsync(CancellationToken cancellationToken) { Interlocked.CompareExchange( ref flushingTask, Task.Delay(200, cancellationToken).ContinueWith( async (t) => { await write.FlushAsync(cancellationToken); Interlocked.Exchange(ref flushingTask, null); }, cancellationToken), null); return Task.FromResult(true); }