When all foreground threads are gone, CLR stops the background threads. That can be read a lot. But what I want to know is how the background thread or the application can detect this situation.
Why? I consider it a bad style to let background threads be killed automatically by some CLR magic, so I normally write code to ensure that a thread gets terminated in a ordered way. But failing to do so, would hang the application in the process of being terminated. So I am considering to mark my worker threads as "background", to avoid the hang, but I still want to know that it happens, so that I can fix that bug.
Is there some equivalent to a ThreadAbortException
that I can catch in the thread main method or some handler I can register?