Generally, use the thread pool whenever possible.
Except for the following four situations:
- The thread needs to be manually controlled to run on a non-default priority (not recommended)
- It must be displayed as a foreground thread
- It takes a long time to run a task
- To manually control the lifecycle of a thread (such as abort)
-------------------------------
In fact, I think there are two more important aspects.
The thread pool is shared globally, that is,ProgramInserting some tasks into the thread pool will inevitably affect others
In extreme cases, you occupy all the objects in the thread pool, and other programs cannot run normally (including some threads of. Net itself)
The key is
Do not occupy the thread pool for a long time or a large amount, unless it can be determined that the current program is the most important program on this server
On a high-pressure server, or your program may consume a large amount of resources, you 'd better implement a controllable thread pool (such as some open-source implementations above codeproject) by yourself ), in this way, you can better control and schedule the use of system resources.