-
Notifications
You must be signed in to change notification settings - Fork 10
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
Audit context guard soundness #26
Comments
Sorry for the delay. That's a valid observation. Since only one context may be active at a time (per thread), a probable solution would be to use a thread-local stack instead of each context tracking their predecessor. EDIT: Although that does not guarantee soundness either, but I believe I have a different solution. |
I've pondered more about a potential solution and each have their own pros and cons
It may also be worth mentioning that none of these options would solve scenarios where values are intermixed from different contexts: let object1 = Object::new(&guard1);
let guard2 = guard1.switch(&context2);
// `object1` is associated with `context1`, whilst a value from `context2` is assigned.
object1.set(&guard2, &property, Number::new(&guard2, 10)); This may be solved by each value tracking its own associated context, but I'm not sure it's worth the overhead. I'd love some input if anyone is interested or has any ideas. I will continue to ponder but I believe using runtime + |
How is the soundness of
Context::make_current
guaranteed? For example, what happens if user calls it for two different contexts and then drops the guard in reverse order?The text was updated successfully, but these errors were encountered: