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

[browser][MT] fix .Wait in CompleteTask #101078

Merged
merged 5 commits into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,12 @@ public static void CompleteTask(JSMarshalerArgument* arguments_buffer)
}
}

// this is always running on I/O thread, so it will not throw PNSE
// it's also OK to block here, because we know we will only block shortly, as this is just race with the other thread.
if (holder.Callback != null)
{
Thread.ForceBlockingWait(static (b) => ((ManualResetEventSlim)b).Wait(), holder.CallbackReady);
}

holder.CallbackReady?.Wait();

lock (ctx)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ public async Task WebSocketClient_ContentInSameThread(Executor executor)


[Theory, MemberData(nameof(GetTargetThreads2x))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/100931")]
public async Task WebSocketClient_ResponseCloseInDifferentThread(Executor executor1, Executor executor2)
{
using var cts = CreateTestCaseTimeoutSource();
Expand Down