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

Could poisoning be implemented for Thunk to allow use with std::panic::catch_unwind? #4

Open
daboross opened this issue Aug 10, 2019 · 0 comments

Comments

@daboross
Copy link

If the closure passed into thunk::unsync::Thunk panics, then evaluate_thunk will leave self in the Cache { evaluating: () } state, while the flag is still set to Deferred.

This is partially correctly prohibited by Thunk containing an UnsafeCell and not implementing std::panic::RefUnwindSafe.

However, if thunk::unsync::Thunk implemented poisoning, then it could become RefUnwindSafe and be used in situations where std::panic::catch_unwind is useful. I think this would just look like setting the flag to some Flag::Poisoned directly before running the closure, right after line 168. Then if Poisoned is encountered, it could just panic with a message "thunk poisoned"?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant