concurrent.futures as a solution for blocking tasks

In this section, we will be considering another way to implement threading/multiprocessing: the concurrent.futures module, which is designed to be a high-level interface for implementing asynchronous tasks. Specifically, the concurrent.futures module works seamlessly with the asyncio module, and, in addition, it provides an abstract class called Executor, which contains the skeleton of the two main classes that implement asynchronous threading and multiprocessing, respectively (as suggested by their names): ThreadPoolExecutor and ProcessPoolExecutor.

Get Advanced Python Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.