Re: Multiple Threads Within the IDE

From: Richard Blewett [DevelopMentor] (richardb_at_develop.com)
Date: 10/08/04


To: microsoft.public.dotnet.languages.csharp
Date: Fri, 08 Oct 2004 01:43:15 -0700

well if you just want the trheads to terminate when teh main thread does set their IsBackground property to true. If you want the threads to come down in a controlled fashion, signal them (by an event, flag or Interrupt) and issue a Join on them before the form closes.

 The main issue is that threads created uwing the Thread class will, by default, keep your process running.

 Regards

 Richard Blewett - DevelopMentor
 http://staff.develop.com/richardb/weblog

   nntp://news.microsoft.com/microsoft.public.dotnet.languages.csharp/>

 I was noticing that when I run a multi-threaded app from within the IDE and
 then I close the main form (which spun off all of the threads), that the
 Stop/Pause VCR buttons in the debugger are still available & working. It's
 like closing the form did not actually cancel the threads.
 
 From my earlier discussions on the newsgroup, I know how people already feel
 about Thread.Abort(), so I was wondering what I need to do to "clean up"
 when closing a main form that has spun off worker threads (I was under the
 impression that this cleanup would automatically happen, but seeing the
 Stop/Pause VCR buttons on the debugger being active & working tell me
 otherwise).
 
 Any thoughts would be appreciated.
 
 --
 Doug Thews
 Director, Customer Solutions
 D&D Consulting Services
 ----------------
 Visit my Tech Blog at:
 
http://www.ddconsult.com/blogs/illuminati/
 
 
 
 
 
 ---
 Incoming mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.771 / Virus Database: 518 - Release Date: 28/09/2004

 
 [microsoft.public.dotnet.languages.csharp]