7 Handling blockingwork with threads
This chapter covers
- Reviewing the multithreading library
- Creating thread pools to handle blocking I/O
- Using
async
andawait
to manage threads - Handling blocking I/O libraries with thread pools
- Handling shared data and locking with threads
- Handling CPU-bound work in threads
When developing a new I/O-bound application from scratch, asyncio may be a natural technology choice. From the beginning, you’ll be able to use non-blocking libraries that work with asyncio, such as asyncpg and aiohttp, as you begin development. However, greenfields (a project lacking constraints imposed by prior work) development is a luxury that many software developers don’t have. A large portion of our work may be managing existing ...
Get Python Concurrency with asyncio 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.