When creating a new System.Thread instance the default value of IsBackground is false. Can anybody shed the light on why this would be the default value would be not be true. My inclination, correct or not, when creating a thread is that it would be run in the background of the main thread.
Thank you for the quick responses.
I do provide functionality in the destructor of my component to allow for the thread to end gracefullly. I am using a ManualResetEvent and Join.
I fully understand that allowing the thread to end gracefully is correct and proper.
What I am not conceptualizing is that why. by default, a thread must hang an entire application if it does not end successfully when the application is exiting.
IsBackgroundmeans that the thread is terminated when the application terminates. This is rarely desirable behaviour, because it means that thread can’t stop and clean up properly.Instead, the app should signal the thread to terminate, wait until it has done so, and then close properly.
That’s my summary of this blurb from the
Thread.IsBackgroundMSDN article: