-
-
Save ElanHasson/9953146 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment