Chapter 3. Using a Thread Pool

In this chapter, we will describe the common techniques that are used for working with shared resources from multiple threads. You will learn the following recipes:

  • Invoking a delegate on a thread pool
  • Posting an asynchronous operation on a thread pool
  • A thread pool and the degree of parallelism
  • Implementing a cancellation option
  • Using a wait handle and timeout with a thread pool
  • Using a timer
  • Using the BackgroundWorker component

Introduction

In the previous chapters, we discussed several ways to create threads and organize their cooperation. Now, let's consider another scenario where we will create many asynchronous operations that take very little time to complete. As we discussed in the Introduction section of Chapter ...

Get Multithreading with C# Cookbook - Second Edition 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.