Thread Pool

Now you have AppDomains that have been described as lightweight processes, and Threads that are contained in AppDomains. It is time to introduce a lighter still Thread that is spawned from the ThreadPool class. Starting up a Thread takes little overhead, but even a little overhead is some overhead. Starting a Thread from a pool of Threads removes much of the startup costs associated with starting a Thread from scratch. The Thread is queued, and the system (the CLR) determines when and with what resources it should be run.

QueueUserWorkItem

The Thread that is queued by QueueUserWorkItem is part of a pool and it can be assigned to some other work immediately after completing the work that you assigned it to do. Therefore, you are not ...

Get .NET Common Language Runtime Unleashed 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.