Skip to content

Commit

Permalink
[browser][MT] fix .Wait in CompleteTask (#101078)
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelsavara committed Apr 16, 2024
1 parent 42f2b33 commit bfea872
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,11 @@ 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.
holder.CallbackReady?.Wait();
if (holder.CallbackReady != null)
{
Thread.ForceBlockingWait(static (b) => ((ManualResetEventSlim)b!).Wait(), holder.CallbackReady);
}

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

0 comments on commit bfea872

Please sign in to comment.