In this section, we will discuss various ways of using the
try..catch block to perform error handling and coordination of multiple threads.
In this example, we are going to write a simple console application that demonstrates a typical producer-consumer model. We will also demonstrate using a
try..catch to coordinate activities as well as the join and lock mechanism previously discussed. This exercise will cement everything we have learned in this chapter so far.
Also, as we will see in future chapters the producer-consumer design pattern is one of the most commonly used design patterns in multithreaded problem solving and is used a lot with the Task Parallel Library. It describes a design where one thread (or a group ...