Multiple Threads Within the IDE

  • Thread starter Thread starter Doug Thews
  • Start date Start date
Agreed. It's probably better to just use "true" instead of a variable, and
then catch the Interrupted exception (if you want a thread that runs
continuously and only quits when the app quits - as I was suggesting):

try
{
while( true )
{
// perform whatever
}
}
catch (ThreadInterruptedException)
{
// Perform cleanup - then return
return;
}


--
Doug Thews
Director, Customer Solutions
D&D Consulting Services
----------------
Visit my Tech Blog at:
http://www.ddconsult.com/blogs/illuminati/
 
Doug Thews said:
Agreed. It's probably better to just use "true" instead of a variable, and
then catch the Interrupted exception (if you want a thread that runs
continuously and only quits when the app quits - as I was suggesting):

try
{
while( true )
{
// perform whatever
}
}
catch (ThreadInterruptedException)
{
// Perform cleanup - then return
return;
}

No, I don't agree with that. It means that you don't really know where
you were when you were interrupted. I prefer to still use an orderly
stopping procedure, but do it in a thread-safe way.
 
Back
Top