In this chapter, we will cover the following recipes:
- Providing futures with a CPU pool and waiting for them
- Implementing error handling for futures
- Combining futures
- Using Streams
- Using Sinks
- Using the oneshot channel
- Returning futures
- Locking resources with BiLocks
Introduction
Futures provide the building blocks for asynchronous computations with zero-cost abstraction. Asynchronous communication is useful for handling timeouts, computing across thread pools, network responses, and any function that does not immediately return a value.
In a synchronous block, the computer would execute each command sequentially after waiting for each command to return a value. If you were to apply the synchronous model when sending ...