ThreadPool.QueueUserWorkItem worker thread quit quietly?

G

Guest

Hello All,

I met a strange behavior with the system threadpool. The worker thread seems
to quit in the middle of processing. Here is the code: I could see the step 1
is finished but step 2 is not finished. There was no exception. Any thoughts?


{
....
ThreadPool.QueueUserWorkItem(new WaitCallback(Process_Data), myObj)
....
}

static void Process_Data(object Data)
{
....
try
{
//step 1
...
//step 2
...
}
catch ()
{
....
}
}
 
G

Guest

Hi Mark,

Thanks for reply. If there is an exception in the threadpool thread, shall
the Try...Catch catch the exception? I have the Try Catch around the callback
function.
 
G

Guest

Your try catch would catch any exception that reached it. Is it possible
there is some other try/catch statement which is silently comsuming the
exceptions, what is happening between step1 and step2? i.e.

try
{
//do some stuff
}
catch
{
//do nothing
}

Mark.
 

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