fguihen Posted February 17, 2004 Posted February 17, 2004 i have 2 threads running in my c# application. the only exit button on the program is the X in the top right corner. is thare any method or deligate that i can call upon when the program is being closed, to kill of any threads running in memory? do you have to kill off timers also, since they are very similar to threads? Quote
jorge Posted February 17, 2004 Posted February 17, 2004 set all treads to run in background (name. IsBackground = 1) will do they will terminate when the application ends. Quote Jorge - http://www.blackdot.be/?page=apache.htm
samsmithnz Posted February 17, 2004 Posted February 17, 2004 Timers will kill off themselves, since they are merged into your forms. You could double check that none of your threads are running in your form_unload event (sorry don't know the c# equivalant) and close any that are still running to be doubly sure. Quote Thanks Sam http://www.samsmith.co.nz
fguihen Posted February 17, 2004 Author Posted February 17, 2004 the timers i use arnt System.Windows.forms.timers. theyre system.timers. different animals altogether. the forms.timers are not safe in a multithreadded envrionment. Quote
*Gurus* Derek Stone Posted February 17, 2004 *Gurus* Posted February 17, 2004 If the threads should terminate along with the rest of the application, then set the Thread.IsBackground property as mentioned by Jorge above. Quote Posting Guidelines
*Gurus* Derek Stone Posted February 17, 2004 *Gurus* Posted February 17, 2004 As for your timers you should be keeping a reference to them throughout the lifetime of the application. Quote Posting Guidelines
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.