Tuesday, February 26, 2013

Threading: 11- Background & Foreground threads

Managed thread can be either background or foreground. Differences are listed below.

If all the foregrounds are completed, background threads will be automatically closed and application will be closed. By default all applications will have a main foreground thread.

 

Background threads can be created by setting Thread’s IsBackground property to true. By default, a thread will be created as foreground thread.

 

var th = new Thread(Greet);
th.Name = "Greeting";
th.IsBackground = true;

No comments:

Post a Comment