"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om...
Dave <no****************@wi.rr.com> wrote: Drew, it may be a thread from the thread pool. These threads are created
and destroyed dynamically. Operations that are asynchronous often are
completed on a threadpool thread, such as network operations and timers.
But the point of a threadpool thread (in the current implementation) is
that it *doesn't* get destroyed - it hangs around for more work to do.
A more generalised threadpool may indeed create and destroy threads
based on various criteria, but I believe the .NET one just creates a
fixed number (25 per processor?) and leaves them there waiting for
work.
I don't believe that's true - threadpool threads get created only as needed.
I just built a simple test app, queued up some work items, and the thread(s)
got created as I expected but I did not see them get destroyed. I had
thought there was a decay timer associated with each thread, and if enough
time goes by the thread would get destroyed, but either the implementation
changed, I was misinformed, or the conditions for destroying the thread
never occurred.
Our client application makes extensive use of web services, and after some
network traffic we always see the message that threads are getting
destroyed, so I know there is dynamic creation/destruction of threads. I
still believe these are threadpool threads but I would have to do more
investigation to prove it.