Why doesn't Thread implement IDisposable? Why doesn't Thread implement IDisposable? multithreading multithreading

Why doesn't Thread implement IDisposable?


What would disposing of a Thread object do? The "resource" in this case has its own natural clean-up - the thread finishing. Note that also the sense of ownership is missing... within the executing thread, you can always use Thread.CurrentThread, so only that thread would really able to claim any sort of ownership.

Basically I think Thread is a slightly unusual case - there's a lifetime to the underlying resource, but it isn't something that ought to be cleaned up explicitly.


That's probably because you can't dispose of a thread. Instead you can ask it to die using Abort() or alike.


This is kind of a design question, so anyone who was not involved in building this aspect of .NET can only speculate. That being said, this blog post makes a good point:

...implementing IDisposable would not make any difference, at least in the current implementation of Thread. I increased the number of threads being created and the handle count goes down at some point so there is some mechanism for closing them

Threads do naturally clean up after themselves, so they are not a resource that needs to be managed in the typical sense.