O'Reilly logo

.NET Framework 4.5 Expert Programming Cookbook by A.P. Rajshekhar

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

Chapter 3. Threading and Parallel Programming

In this chapter, we will cover:

  • Handling Producer-Consumer race condition using locking
  • How to handle background threads in Windows Forms
  • Points to keep in mind when threading
  • Parallelizing image processing
  • Chaining two parallelized bulk image processing operations

Introduction

The focus of this chapter will be on threading and parallel programming . We will start with using the Monitor class to implement locking in order to avoid race conditions. Race conditions are common occurrences in Producer-Consumer scenarios. This recipe will use console-based applications and not Windows Forms since we will see how to handle user/background threads along with UI threads in Windows Forms in the third recipe. Then ...

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