-
Notifications
You must be signed in to change notification settings - Fork 772
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
Cancellable: Use AsyncLocal instead of ThreadStatic #17156
Conversation
❗ Release notes required
|
@auduchinok, Does it make sense? |
From a glance, yes, thanks! I’ll probably need to do some testing just in case, though :) |
I'm trying to write some tests using |
OK, the problem with testing the cancellable CE is as described here: It is internal and exposed to the test project via InternalsVisibleTo, which clashes with inlining.
I can't think of a way around this limitation. |
Yeah, I don't think there's a way around it. When I tried to rewrite it to resumable code, I hit some issues with inlining cross projects. |
One thing that comes to my mind is to include link to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, thanks, let's get this in!
@majocha thanks for trying testing it, if you come with any extra ideas in that regard, we can do a followup.
Similar to #16779, Keeping the token in
AsyncLocal
could work better in scenarios with lots of parallelism like we have in Transparent Compiler.todo: add some tests mixing cancellable with async, TPL, thread switching etc.
related: #16137, #16348, #16536