Stop and delete a thread after completing a task in .net

I developed one windowed application in C #, where I create one thread to execute one schedule event. Now this application will work all day, and it will create one thread for each execution of each event. How to remove threads from memory after completing the task assigned to this thread. I do not want to limit the number of threads created by using the thread pool and assigning it a specific account for the maximum thread.

+6
source share
1 answer

After the thread completes its execution, it will no longer consume memory, and this will be the goal of collecting the garbage collector, so don't worry about it. however, if you use Task , the Task object is IDisposable , it is good practice for Dispose when it completes its execution.

+4
source

Source: https://habr.com/ru/post/894008/


All Articles