-
Notifications
You must be signed in to change notification settings - Fork 41
Could lilos_handoff::Push take &mut Option<T> to be cancel safe? #9
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
Comments
I believe while this fixes the issue with dropping the future returned by As I understand the problem, we want to perform two operations: generating some value and sending this value to a different task. With the current API is that we always need to generate the value before sending it. Ideally, we would only generate the value when we can be sure to succeed in sending it. |
I have to think about that. I wonder it it could actually be done soundly.. if the pop end is waiting, we get a permit. Then the pop future is cancelled and forgotten (no Drop), but the permit would still seem valid. I think this one-step approach is the only valid option. That said, maybe an API that takes |
Okay so I clearly need to fix my Github notification settings. Hello from like seven months later! On @korrat's point - I tried rewriting the @mattfbacon - I think your The fact that |
After thinking about @korrat's analysis in #14, I'm less confident about
There are various small changes I could imagine to address one piece or the other -- for instance, we could maintain a "data lost" flag so that there's at least some indication that this happened, though I don't see how I would use that in practice to fix an application. I am currently leaning toward concluding that I've also tested the associated PR on some of my firmware, and it increases code size by a small but measurable amount. I'm investigating the causes. I suspect that the compiler is unable to entirely eliminate the operations on the Option, which is odd since it appears to be totally inlining Given (1) the realization that a minimum-copy I'm definitely open to alternatives, or to being convinced otherwise. |
Ah, good point, it's cancel-safe in the case where the push_from happens before the pop, but not vice versa, because of the PopWait variant. Maybe I'm missing something, but why does the popper need to provide the location in this variant? Why couldn't the popper wait until the PushWait condition occurs, then take it from that? |
This way the pointer could be directly provided so the T isn't taken out unless the future succeeds.
The text was updated successfully, but these errors were encountered: