ThreadPool query

  • Thread starter Thread starter Steven Blair
  • Start date Start date
S

Steven Blair

I start a thread like this:

ThreadPool.QueueUserWorkItem(new WaitCallback(Receive), this);

private static void Receive(object obj)
{
while(true)
{
//Do some stuff then eventually break;
}
}

Receive could be processing for any amount of time, but a condition is
met and the method exits.

Does this then free up the Thread request originally by my WaitCallback,
or do I have to notify the ThreadPool I am finished?

Steven
 
When your callback method completes (reaches the closing brace) the thread is
returned to the available threads in the pool and can handle another workitem.
Peter
 
Back
Top