-
Notifications
You must be signed in to change notification settings - Fork 643
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 atomic unsafe response type. enable async handler #449
Conversation
This comment has been minimized.
This comment has been minimized.
I'm not yet decided how to guard the input. Edit: Use a closure for guarding input for now. |
So what's the path forward for this PR. Is it ready for review and if so which parts should be focussed on. A note after skimming over a couple files: a few fns are documented with "do not expose to public api". Are these fns better as unsafe? Also consider documenting the invariants that must be upheld regardless. |
Hard to say it's ready as it's pretty hard to test the unsafes added. It would need some really edge cases to see if it holds up.
The unsafe code only affect people who actually call |
Making this a draft for now until proper tests are added. |
I have reverted most changes related to actor context. Making |
definitely excited about this but i think we should do a release without it first |
Agreed. I'm not confident in this either. There are still small issues to this approach so it's more like an experiment for the Concurrent variant AsyncResponse. |
After some additional tests I find there is no way to actively go into stopping state during an async response actor future. |
lmk if you want a review of this now |
@robjtede I think this is ready for review. |
I don't have time to keep this PR up to date anymore. It's welcomed to step in and take charge of it. |
fn handle(self, ctx: &mut A::Context, tx: Option<OneshotSender<M::Result>>) { | ||
match self { | ||
AsyncResponse::Atomic(fut) => { | ||
ctx.wait(fut.map(move |res, _, _| tx.send(res))); |
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.
Sorry for reviving this....
Isn't this unsound already ? You have two &mut A::Context
alive at the same time, one given to the method and the other inside the future.
PR Type
Feature
PR Checklist
Check your PR fulfills the following:
Overview
AtomicResponse actually could enable borrowing Actor and it's Context in async/await.
This PR just use it with some unsafe code to enable async/await.
It's also possible to immutably borrowing Actor and it's Context in async/await without atomic,
by grouping shared reference responses and block actor on them.
It's basically a batched version of AtomicResponse.
Closes #308 #378 #438