-
Notifications
You must be signed in to change notification settings - Fork 252
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
Is block_on an executor? #219
Comments
another important thing to consider is crates that provide futures for io, and launch a background thread in order to Wake those futures, notifying the executor when they can make progress, but do not provide any way of polling those futures. in short, there are two parts:
note the 2 is actually optional, a simple future can just call Waker::wake() immediatly before returning Poll::Pending. the second thing defiantly needs a name though. |
my interpretation (mostly informed by reading
although the docs are a bit unclear, so i'm unsure if this is the intended interpretation. adding a Glossary section to the async book would probably help. |
@lbernick you wrote the relevant paragraph, mind weighing in on this? |
Sorry @lolbinarycat, I haven't worked on async rust in a few years so I don't think I'm the best person to weigh in here. |
i'm just asking what you meant when you wrote that words i'm really not sure who else could weigh in on this.. i guess it becomes an issue of prescriptivism vs descriptivism.. i guess a survey of how the words are used could help, but that's a lot of work. |
In general, but also in this book, I've heard the word "executor" refer to what I believe are two different concepts:
smol::Executor
is a good example of this).smol::future::block_on
.I think these are two different concepts, but they're often both referred to as "executors".
Executor
is not able to poll a future to completion on its own; it requires a top-levelblock_on
for that. On the other hand,block_on
on its own can only poll one future to completion.Internally I've referred to the latter case (
block_on
) as a "reactor"; however it seems this is incorrect.async_io::block_on
is fairly certainly a reactor, since it handles I/O events and timers.However,
futures_lite::block_on
is in a gray area here. It handles no I/O events, it just polls the future to completion. I would argue that this is a reactor in the same way that()
is a type.I'm wondering if the book can be updated to clarify the differences here.
The text was updated successfully, but these errors were encountered: