After my application creates a thread using a ParameterizedThreadStart
delegate, that thread performs some initialization and runs to completion. Later on, I can observe that this thread is no longer active because its IsAlive
property is false and ThreadState
property is ThreadState.Stopped
.
Once a thread reaches this state they remain in my application, still existing as thread objects until my application shuts down. Are there any steps I can take to dispose of them once they're no longer active? I would like to delete the object and deallocate any resources so that any given moment the only thread objects I have are active threads. Thread doesn't implement IDisposable, though, so I'm not sure how I should do this.