Proper thread termination in multi-threaded C# application

Posted by Brian on Stack Overflow See other posts from Stack Overflow or by Brian
Published on 2010-04-23T19:23:54Z Indexed on 2010/04/23 19:33 UTC
Read the original article Hit count: 191

Filed under:
|

I have what I think is a rather complex problem. I have a C# application that utilizes a plug-in architecture using reflection. The application loads plug-in dlls and the user is able to enable/disable them. When a plug-in is enabled, the main app starts a thread to run the plug-in in. In many cases the plug-in may have multiple threads of its own. When I want to disable a plug-in I am calling Thread.Abort(). This seems to kill the initial thread that was created for the plug-in, but any additional threads that the plug-in created continue running. Is there a better way to stop all of the associated plug-in's threads along with the main thread?

Thanks.

© Stack Overflow or respective owner

Related posts about c#

Related posts about multithreading