Chapter 11. Threading

In this chapter we will cover:

  • Updating the UI from a non-UI thread
  • Adding cancelation support
  • Using the BackgroundWorker component
  • Adding cancelation and progress with BackgroundWorker
  • Using a timer to do periodic updates
  • Using C# 5.0 to perform asynchronous operations

Introduction

The computer world is going through a revolution in terms of the way code is written. From (mostly) single CPU systems, current computers have multi-core processors, capable of performing concurrent operations. The shift is mostly due to hardware limitations that don't allow current technology to increase CPU clock frequency by much (if at all). The solution: create more cores.

But, more cores means the "free lunch is over" (as Herb Sutter put it nicely). ...

Get Windows Presentation Foundation 4.5 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.