It is important in a lot of cases to coordinate and wait on threads. Take, for example, a pipelining design. Once we start a group of concurrent threads, we then need to wait on them all to finish, collate their results, and move onto the nonconcurrent section. We need to know when threads finish and what their results are, so we can determine how to proceed.
There are several ways to coordinate and wait between threads. In the following example, we will show how you can check to see if a thread is still alive and processing and then wait on all of the threads to complete their bitmap processing work before we continue the rest of the application and reassemble the bitmap pieces.
In this example, we will use the