ThreadPool query

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
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top