Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change hang to blocking #47863

Merged
merged 1 commit into from
Sep 19, 2020
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