In general, but also in this book, I've heard the word "executor" refer to what I believe are two different concepts:
- A queue of tasks scheduled to be ran across a set of threads (I would argue this is an executor, and
smol::Executor is a good example of this).
- A system that runs one single task to completion. For example,
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-level block_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.
In general, but also in this book, I've heard the word "executor" refer to what I believe are two different concepts:
smol::Executoris 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".
Executoris not able to poll a future to completion on its own; it requires a top-levelblock_onfor that. On the other hand,block_onon 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_onis fairly certainly a reactor, since it handles I/O events and timers.However,
futures_lite::block_onis 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.