-
Notifications
You must be signed in to change notification settings - Fork 638
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
executor::spawn() in futures-preview 0.3 #1421
Comments
I would be interested in preparing a PR for this, but I might need a bit of mentoring. I've tried adding an |
Using Another tangential point of interest is that the global |
Pinging @Matthias247 and @cramertj. Is there any reason why |
@ebkalderon The comment change in that commit might be misleading, and change it from "incorrect" to "slightly less incorrect". Regarding the original question: Spawning futures on |
Btw: I figured out through this issue that |
@Matthias247 Thanks for clearing up a few things! I already noticed that it's already possible to spawn futures on a |
|
That's a shame. So if I have a future that needs to spawn a task from within itself, I need to thread in a I'm working around this currently by using |
It's likely that there will be a crate providing a TLS based spawner for users that want this convenience, hopefully even a cross-executor one where libraries can use the convenient API and it just gets routed to whichever concrete executor is actually running. (EDIT: for prior art in a design like this see That might be a good reason to not provide a concrete global threadpool here, IMO it would be better for the ecosystem for most users to use a crate dedicated to providing an abstract global spawner that |
I've just thrown together a basic generic TLS based spawner just to make sure the idea works, I'll try and polish this up and put it onto crates.io sometime soon: https://github.com/Nemo157/futures-global-spawner/blob/master/tests/smoke.rs |
I noticed that
futures-preview
0.3.0 provides its own default global threadpool, similar totokio
0.1, exposed through theexecutor::block_on()
andexecutor::block_on_stream()
functions. Would it be possible to add anexecutor::spawn()
function for spawning futures on the pool as well?The text was updated successfully, but these errors were encountered: