- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Thread Pools in C#
Thread pool in C# is a collection of threads. It is used to perform tasks in the background. When a thread completes a task, it is sent to the queue wherein all the waiting threads are present. This is done so that it can be reused.
Let us see how to create a thread pool.
Firstly, use the following namespace −
using System.Threading;
Now, call the threadpool class, using the threadpool object. Call the method QueueUserWorkItem −
ThreadPool.QueueUserWorkItem(new WaitCallback(Run));
Iterate this in a loop and compare it with a normal Thread object.
Advertisements