Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As discussed in #9, this PR adds async support to
IFrameProcessor
and its implementationFrameProcessor
.The API has been extended by two methods, which, as discussed in #9, take/return a
ValueTask
andValueTask<T>
.To avoid code duplication, I've used a pattern which uses a flag argument for internal methods to determine if the methods should be called asynchronously or not.
More information on that pattern:
Having async methods also allows reading/writing the stream in an async manner, which further improves the performance, which is why I've included it in this PR.
For now, I've decided to not include
CancellationToken
overloads or default parameters for the async methods as this complicates things a lot, especially with thenotifyHandler
callback. In addition, we'd need to define when and how we'd safely cancel reading/writing from/to the stream.As discussed in #9, using
ValueTask
andValueTask<T>
innetstandard2.0
requires adding a dependency toSystem.Threading.Tasks.Extensions
. As I think the multi-targeting out of scope for this PR, I've not implemented anything regarding this topic.