thread is runing in background?!
Hello frineds!
it is said:
Foreground and Background Threads
By default, threads are foreground threads, meaning they keep the application alive for as long as any one of them is running. C# also supports background threads, which dont keep the application alive on their own terminating immediately once all foreground threads have ended.
also take a look at this:
http://msdn2.microsoft.com/en-us/library/h339syd0.aspx
it is not clear to me what does it mean: a thread is runing in backgroung..
Please explain about that.
[577 byte] By [
Abalfazl] at [2007-11-20 11:39:22]

# 1 Re: thread is runing in background?!
By default a managed application has one foreground thread when the app starts up. Any additional threads must be created by the programmer.
In a non-managed windows app, the programmer must shut any 'background' threads down when exiting the app otherwise the app will keep running. For example, if I created a windows dialog app and create a second thread to read some data from a socket. When the user presses the close button, the dialog will disappear, but if I don't take action to signal the secondary thread to exit, the application will remain open (as can be viewed in task manager).
On the other hand, in a managed dialog app under the same scenario, the .net framework will close the secondary 'background' thread for me when I close the dialog, and the app will exit process (i.e. it will disapear from task manager as expected).
Arjay at 2007-11-9 13:59:35 >
