In the previous chapters, we’ve looked at a few examples of how to cancel threads and tasks. This chapter will explore more of the methods available to cancel concurrent and parallel work with C# and .NET. The methods in this chapter will provide alternative ways to cancel background operations using callbacks, polling, and wait handles. You will gain a deeper understanding of how to safely cancel asynchronous work with a variety of methods using some practical scenarios.
In this chapter, you will learn about the following topics:
- Canceling managed threads
- Canceling parallel work
- Discovering patterns for thread cancellation
- Handling multiple cancelation sources
By the end of this chapter, you will understand how to cancel different types of asynchronous and parallel tasks.