by steveklabnik · 7y ago · 0 comments
At its core, when you pass a Future (really, a chain of futures, but in the end that's still a Future) to an executor, the executor creates a stack for it. An executor with multiple futures will then switch between them, sorta similar to the code seen here. The details depend on the exact executor, of course, but the fundamental idea is the same.
One of the nice things about the futures design is that you can know exactly how big the stack needs to be, so the resizing stuff isn't an issue.