I feel like I should know the answer to this, but I\'m going to ask anyway just in case I\'m making a potentially catastrophic mistake.
The following code executes a
Looks like a risky pattern to me, even if due to the [current] implementation, it is OK. you are trying to dispose a resource which may still be in use.
It is like newing and constructing an object and deleting it blindly even before consumers of that object is done.
Even otherwise there is a problem here. Program may exit, even before other threads ever got a chance to run. Thread pool threads are background threads.
Given that you have to wait for other threads anyway, you might as well clean up afterwards.