开发者

thread pool creation in .net(C#)

开发者 https://www.devze.com 2023-03-02 12:05 出处:网络
wh开发者_C百科en does the thread pool is created? it is during the creation of the process or the first element is queued in the pool

wh开发者_C百科en does the thread pool is created? it is during the creation of the process or the first element is queued in the pool


When the CLR initializes, its thread pool contains no threads. When the application wants to create a thread to perform a task, the application should request the task be performed by a thread pool thread. The thread pool knows that and will create an initial thread. This new thread will go through the same initialization as any other thread; but, when the task is complete, the thread will not destroy itself. Instead, the thread will return to the thread pool in a suspended state. If the application makes another request of the thread pool, then the suspended thread will just wake up and perform the task and a new thread will not be created.

from http://msdn.microsoft.com/en-us/magazine/cc164139.aspx

this is rather a rather good introduction too:

http://msdn.microsoft.com/en-us/library/ms973903.aspx#threadpool_topic11


A ThreadPool is not created, it only has static members (MSDN ref). You can set the minimum and maximum number of threads that a ThreadPool has, and add work items to it, which execute when the ThreadPool has an available thread. So your question doesn't really make sense, I think you need to clarify it.

0

精彩评论

暂无评论...
验证码 换一张
取 消