4
There are already some questions about the interface IDisposable
and the using
, for example:
What types of resources are released in a statement using
Still I’m not sure what to do about threads.
In my mind if the object uses any thread explicitly, it makes sense to ensure that this thread end the use of thread.join()
for example.
This would serve to ensure there is no work to be done in background but would also decrease the resources (in this case CPU) used by this threads.
In addition I also ensured that the threads would be in a known (terminated) state, rather than in an unknown state.
I know the CPU is not a resource that can be reserved by thread and that there is nothing that guarantees that my thread is using it.
But my premise is this: If I can assure you that there is no work to be done on threads, why not do it?
What should I do anyway? I must ensure that mine threads end or not?
I get it. It’s the typical duality of must vs can found in documents ISO. Maybe it’s a problem that must be solved in a method other than Dysplasia
– Bruno Costa