Summary
In this chapter, we learned how to create and manage threads, how to pass arguments or retrieve results, how TLS works, and how to wait for a thread to finish. We also learned how to make a thread yield control to others or cancel its execution. If something goes wrong and an exception is thrown, we now know how to pass the exception between threads and avoid an unexpected program termination. Finally, we implemented a timer
class that periodically runs a callback function.
In the next chapter, we will learn about thread safety, mutual exclusion, and atomic operations. That will include mutexes, locking and lock-free algorithms, and memory synchronization ordering, among other topics. That knowledge will help us develop thread-safe data structures and algorithms.