Doug wrote: > If you have embedded IronPython engines (and perhaps a few other DLR > languages) running in a thread, what is the recommended method of > stopping the running programs, and calling the objects' delete methods? > > For example, say you have a serial port open in an IronPython program > running in a thread, and you want to stop the thread, and close the port? Is > there something general that would take care of all closing, just like it > would > if you killed a process? > > Thanks for any suggestions,
You can run the code in an app domain and then just unload the app domain. Any code running in the app domain will be Thread.Abort'd by the CLR and all of the finalizers will run once the threads have been killed - and that should close the serial port or any other resources. Any code with finally blocks and the such will still be given a chance to cleanup as well. _______________________________________________ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com