Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Workspaces/Remote/Core/BrokeredServiceConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ internal static async ValueTask<TResult> InvokeStreamingServiceAsync<TResult>(
var (clientStream, serverStream) = FullDuplexStream.CreatePair();

// Create new tasks that both start executing, rather than invoking the delegates directly.
// If the reader started synchronously reading before the writer task started it would hang, and vice versa
// if the writer synchronously filled the buffer before the reader task started it would also hang.
// If the reader started synchronously reading before the writer task started it would be blocking, and vice versa
// if the writer synchronously filled the buffer before the reader task started it would also be blocking.
var writerTask = Task.Run(async () => await invocation(service, serverStream, cancellationToken).ConfigureAwait(false), cancellationToken);
var readerTask = Task.Run(async () => await reader(clientStream, cancellationToken).ConfigureAwait(false), cancellationToken);
await Task.WhenAll(writerTask, readerTask).ConfigureAwait(false);
Expand Down