O'Reilly logo

C# 2008 and 2005 Threaded Programming: Beginner's Guide by Gastón C. Hillar

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

Time for action - Creating a parallel algorithm coordination class

We have the pieces, but we must now create the class to solve the puzzle. The class must offer us everything we need to know (up to this chapter) to create an efficiently parallelized algorithm:

  1. Stay in the project, OldStarsFinder.
  2. Create a new class, ParallelAlgorithm.
  3. Add the following lines of code at the beginning of the class definition (as we are going to use many System.Threading classes):
    using System.Threading;
    
  4. Add the following public variable (the list of pieces):
    public List<ParallelAlgorithmPiece> prloPieces;
    
  5. Add the following private variable (the AutoResetEvent instances array):
    // The AutoResetEvent instances array
    private AutoResetEvent[] praoAutoResetEventArray;
    

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