Thread abort doesn't work

  • Thread starter Thread starter Thomas Richter
  • Start date Start date
T

Thomas Richter

Hi,
a thread I start with:
threadQuoteRunner = new Thread(new ThreadStart(_quoteHandler.QuoteRunner));
threadQuoteRunner.Start();

but if I try to stop him, it doesn't work:
threadQuoteRunner.Abort();

In the constructor of QuoteRunner is an while (true) loop.
In the debugger I can stop the programm. But if the program is started
by doubleclick I can close the Form but the process is visible with
the taskmanager.

Mit freundlichen Grüßen aus Kiel

Thomas Richter
 
Try setting the IsBackground property of your threadQuoteRunner to true i.e.

threadQuoteRunner.IsBackground = true;

this means that if the main thread is terminated this thread will be
terminated as well. If this is not set to true then when your main thread
tries to quit it will wait before doing do for threadQuoteRunner to complete.

Hope that helps
Mark.
 
Hi,
problem was IO operation on NetworkStream.

Mit freundlichen Grüßen aus Kiel

Thomas Richter
 
Back
Top