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

Signals between threads

To help in coordinating the activity between the multiple threads, we can create variables accessible to the whole class and hence each thread. Then the threads can write to and read from these variables to help them coordinate activity and to keep overall track of what is happening between all of the threads.

We use threads with parameters, as we learned in the previous chapters, and start them with an asynchronous execution using the following loop:

for (liThreadNumber = 0; liThreadNumber < priProcessorCount; liThreadNumber++)
{
    prloThreadList[liThreadNumber].Start(liThreadNumber);
}

Nevertheless, we must wait until the concurrent star finder threads finish their work in order to show the final modified bitmap in the UI. ...

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