Next steps
That was quite a ride. Threading can be complicated, but we got through it all right.
We looked at many different things in this chapter. We described what multitasking is, starting with old-fashioned IRQs, walking through cooperative multitasking, and arriving at the modern style of pre-emptive multitasking.
Then, we investigated Win32 threads and their .NET counterparts. We saw how to create threads but quickly found that the Threadpool
offers a better way of doing so in most cases. However, we learned that most of that is moot, since the TPL handles many details for us.
In particular, we learned that async/await hides much complexity and makes writing multithreaded code a breeze. As with all tools, we learned that async/await comes with risks. You have to know what happens and where bad things can happen. Luckily, we covered those situations as well.
We looked at collections and how to make your code thread-safe. We also learned something fundamental regarding...