Background and motivation
Currently WaitForPipe() is blocking the thread. Adding an async version with support for timeout let us better handle situations where the client cannot or has not read all remaining bytes within an expected duration. I.e. network failure or delay or client has been shut down etc.
API Proposal
namespace System.IO.Pipes
public abstract class PipeStream : Stream
{
public Task WaitForPipeDrainAsync(CancellationToken cancellationToken);
}
API Usage
var ct = new CancellationTokenSource(3_000).Token;
try
{
await NamedPipe.WaitForPipeDrainAsync(ct)
}
catch (OperationCanceledException e)
{
//Retry or do something else
}
Alternative Designs
No response
Risks
No response
Background and motivation
Currently
WaitForPipe()is blocking the thread. Adding an async version with support for timeout let us better handle situations where the client cannot or has not read all remaining bytes within an expected duration. I.e. network failure or delay or client has been shut down etc.API Proposal
API Usage
Alternative Designs
No response
Risks
No response