December 2023
Intermediate to advanced
1232 pages
33h 12m
English
As we saw in Chapter 19, tasks provide an abstraction for the manipulation of asynchronous work. Tasks are automatically scheduled to the right number of threads, and large tasks can be composed by chaining together small tasks, just as large programs can be composed from multiple small methods.
However, there are some drawbacks to tasks. The principal difficulty with tasks is that they turn your program logic “inside out.” To illustrate this, we begin the chapter with a synchronous method that is blocked on an I/O-bound, high-latency operation —a web request. We then revise this method by leveraging the async/await contextual keywords,1 demonstrating a significant simplification in authoring ...
Read now
Unlock full access