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

Passing parameters to threads

We have used the BackgroundWorker component combined with the Thread class to provide fast execution and UI feedback. Now, we will combine multiple Thread class instances with many BackgroundWorker components to create an application that runs as fast as possible on modern computer architectures. In fact, it will inspect the computer it is running on and create an encryption thread for each processing core the computer has. This will maximize the performance without creating extra threads that will not further improve performance.

We will work with dynamic lists and the Environment.ProcessorCount property to create threads on the fly according to the number of cores on the machine. However, we need some technique to ...

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