Need help regarding threading

  • Thread starter Thread starter trialproduct2004
  • Start date Start date
T

trialproduct2004

Hi all
I am having problem at a time of handling threading.
I am having application containing thread.
In thread procedure i ma using recursive function.
This recursive function is adding some entries in my temprary file.
But when i called abort on thread it is not aborting that thread.
After calling aborting still entries are getting inserted into
temporary files.
That means still recursive function is getting executed.
Can some one tell me why this is happening even after calling abort on
thread.
Is there any alternative for aborting thread.
Please help me as this is very very important for me.

Thanks in advance.
 
The thing that you have to be carefull is that the threaad you are creating
is not creating sub threads inside your recusrisv function other wise you
will never give up.
Try to log the thread ID or name when you start it for the first time then
retrive the current thread name when recusrsive is called, just to be sure
that you are not creating threads of threads.

Post also your sample code
 
I am having problem at a time of handling threading.
I am having application containing thread.
In thread procedure i ma using recursive function.
This recursive function is adding some entries in my temprary file.
But when i called abort on thread it is not aborting that thread.
After calling aborting still entries are getting inserted into
temporary files.
That means still recursive function is getting executed.
Can some one tell me why this is happening even after calling abort on
thread.
Is there any alternative for aborting thread.
Please help me as this is very very important for me.

Could you post a short but complete program which demonstrates the
problem?

See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.

You should pretty much never call Thread.Abort. See
http://www.pobox.com/~skeet/csharp/threads/shutdown.shtml and
http://www.pobox.com/~skeet/csharp/threads/abort.shtml
 
Hi there,

Threads are a bit tricky to work with. Follow other suggestions here (sub
threads). If you cannot figure it out, you can always use a global variable
and have the loop (or whatever you are using for this matter) check this
variable for a particular value that will signal abort.

Good luck!
 
Back
Top