-
Notifications
You must be signed in to change notification settings - Fork 340
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 an unstable task::blocking
function
#251
Conversation
Signed-off-by: Yoshua Wuyts <[email protected]>
I still think we should merge this, but I'm almost wondering if the mapping of blocking -> future should be part of the thread submodule instead. There's something about blocking tasks that makes me feel like it should be part of that. Not sure tho; feel like we may need to talk it through sometime. |
I see the issue that this function will be effectively stable. The proliferation of reaching for an We should instead spend more time on figuring out what a stable blocking interface should be. |
Having to make some changes after running |
After some reflection I see the problem. Whenever a crate exports a trait the crate can only occur once in the dependency tree. Crates with public enums, structs with pub fields and functions that take a struct as an argument have a similar problem. |
Yes please! Is this moving forward? :D |
@skade We've been talking about this for months now, and we haven't made any tangible progress on an API design. Currently there's quite a few other things in-progress, and several other things marked as priority before we could get around to designing this. Where I estimate it'll probably be at least another month or two before this can be prioritized, which imo is too long. I think the higher order bit would be to unblock people who have been waiting on this feature for a long time already, so they can move forward and build projects on top of async-std. We can provide detailed upgrade instructions if we decide to stabilize a different version of the API. cc/ @stjepang I'd be curious for your input here also. edit: Also I suspect we'll slowly be removing many of the existing "unstable" labels in the near future. It's mostly pending review of APIs, and ensuring we didn't miss anything in the signatures. |
I'm comfortable with stabilizing this function, provided we do two changes:
We should probably make blocking tasks behave just like normal tasks spawned using |
@stjepang and I had a chat yesterday, and we're on the same page about what to do. I agree with what he's said in #251 (comment). The only addition I had to what was said is that we should in turn clearly document the difference between |
task::spawn_blocking
functiontask::blocking
function
Signed-off-by: Yoshua Wuyts <[email protected]>
Alright, this PR now exposes |
4038938
to
647aab8
Compare
Signed-off-by: Yoshua Wuyts <[email protected]>
Signed-off-by: Yoshua Wuyts <[email protected]>
I've addressed all feedback, and things are compiling + tests passing so I think this should be good to merge! |
This add an unstable
task::spawn_blocking
function to unblock people (lol) waiting for #65. I'm not sure if this is the right API, but we've talked about addingspawn_local
at some point in the future too, so it doesn't seem too wrong either.Regardless, I think it's time to provide people with at least "unstable" access to this. Thanks!
Closes #219, closes #65
cc/ @zkat
Screenshot