Futures
When a background task is spawned, it might be running concurrently with your main flow forever and never complete its own job (such as the worker threads of a ThreadPool
), or it might be something that will return a result to you sooner or later and you might be waiting for that result (such as a thread that downloads the content of a URL in the background).
These second types of task all share a common behavior: their result will be available in _future_
. So, a result that will be available in the future is commonly referred to as Future
. Programming languages don't all share the same exact definition of futures, and on Python Future
is any function that will be completed in the future, typically returning a result.
Future
is the callable itself, so it's unrelated to the technology that will be used actually to run the callable. You will need a way to let the execution of the callable proceed, and in Python, that's provided by Executor
.
There are executors that can run the futures...