O'Reilly logo

C# Multithreaded and Parallel Programming by Rodney Ringler

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Joining threads

We have already examined joining a thread in the previous chapter. When you join a thread, you tell the current thread to wait on the thread, which you are joining, to complete. This allows you to coordinate work between two threads.

This was very handy in the example where we wanted to know when one piece is complete before we start the next piece.

For our application, let's say we want to examine how the performance changes if all of the bitmap processing threads run sequentially instead of concurrently.

How to do it

If we want all of our bitmap processing threads to run sequentially, then right after we start a thread, we will join the thread. This will halt execution of the main thread until the bitmap processing thread we just ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required