Weer36 3 Posted January 2 Share Posted January 2 Hi everyone! How to kill properly all started by "new Thread(()=>{}).Start()" threads in my plugin? Cuz they are still running after product restarting. Sure i'm cheking stuff like (_isLaunched && Conditions.InGameAndConnectedAndProductStarted) in loop. I'm confused that threads don't kills after MuPlugin.Dispose() method Link to comment Share on other sites More sharing options...
Zer0 137 Posted January 2 Share Posted January 2 That's normal behaviour. If you want to control the life cycle of a thread you have created, you need to keep track of it by assigning it to a variable. This way you can start it in Initialize() and then Stop it in Dispose() // Define the thread and assign it to a variable Thread myThread = new Thread(() => { }); // Start the thread myThread.Start(); // Stop the thread myThread.Abort(); happiness7 1 Link to comment Share on other sites More sharing options...
Weer36 3 Posted January 2 Author Share Posted January 2 OMG it's so easy, shame on me Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now