Tuesday 29 January 2008

Foreground versus background threads in .Net

At the end of a .Net application, all background threads are automatically aborted by the Common Language Runtime (CLR).

To set whether a thread is a background thread, use the IsBackground property of the Thread class.

While background threads end with your application, foreground threads continue to execute if not explicitly aborted/stopped. So it is up to you to ensure that all foreground threads of your application terminate/abort correctly.

No comments: