Can the number of foreground threads be determined in .NET?
I've searched a good deal on the topic and have found little results.  It seems adding foreground into the criteria on any engine I've used causes tons of entry level documents on threading in .Net.

In my current project I have a foreground thread within a static class that lies dormant until it is told otherwise.  It contains a queue of items that must be processed and the items application cannot close without all items being processed.  Write now I have a method that tells the thread that it should stop accepting new items and close when it is finished processing everything, but not everyone on the team remembers to call the method.  Having the GUI close while the process still runs in the background is quite a bug in my opinion.  If I can add a period check to see if the queued thread is the last foreground thread, then I can call the method and not have to worry about others that use the class.
Can the number of foreground threads be determined in .NET?
===

I've searched a good deal on the topic and have found little results.  It seems adding foreground into the criteria on any engine I've used causes tons of entry level documents on threading in .Net.

In my current project I have a foreground thread within a static class that lies dormant until it is told otherwise.  It contains a queue of items that must be processed and the items application cannot close without all items being processed.  Write now I have a method that tells the thread that it should stop accepting new items and close when it is finished processing everything, but not everyone on the team remembers to call the method.  Having the GUI close while the process still runs in the background is quite a bug in my opinion.  If I can add a period check to see if the queued thread is the last foreground thread, then I can call the method and not have to worry about others that use the class.