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

Add JoinableTaskFactory integration #886

Merged
merged 1 commit into from
Mar 1, 2023

Conversation

AArnott
Copy link
Member

@AArnott AArnott commented Mar 1, 2023

This avoids deadlocks that RPC would otherwise introduce by carrying a JoinableTask token across RPC so that when/if the RPC call ever makes it back to the original AppDomain (or never leaves it) such that the callee needs the main thread, it will be able to reach it if the caller owns the main thread.

@AArnott AArnott added this to the v2.15 milestone Mar 1, 2023
This avoids deadlocks that RPC would otherwise introduce by carrying a `JoinableTask` token across RPC so that when/if the RPC call ever makes it back to the original AppDomain (or never leaves it) such that the callee needs the main thread, it will be able to reach it if the caller owns the main thread.
@AArnott AArnott requested a review from BertanAygun March 1, 2023 15:39
@AArnott AArnott marked this pull request as ready for review March 1, 2023 16:06
this.joinableTaskTokenWithoutJtf.Value = parentToken;
}

if (this.JoinableTaskFactory is null || parentToken is null)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there is a JTF instance but no token was provided in the header, should we still use JTF to dispatch for the benefit of the current process? (although I am not sure what benefit there would be)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lifeng and I couldn't think of any benefit in doing so. But there is a non-zero overhead from doing so. Thus, we only do it when we feel it's justified by skipping when there is no parent token.

@AArnott AArnott merged commit d0f15d1 into microsoft:main Mar 1, 2023
@AArnott AArnott deleted the JTFintegration branch March 1, 2023 19:17
@AArnott AArnott mentioned this pull request Mar 6, 2023
AArnott added a commit to AArnott/vs-streamjsonrpc that referenced this pull request Mar 6, 2023
microsoft#886 introduced JsonRpc-JoinableTaskFactory integration, but did not document it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants