On a different question I suggested to use
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
while (processingLock)
Application.DoEvents();
}
in the FormClosing event (with processingLock becoming false immediately after a lengthy calculation was done). It should serve the purpose to have the application close down in an orderly manner and the original poster didn't use threads.
On my suggested answer somebody commented that DoEvents is never good, providing this link: Use of Application.DoEvents()
I read and (I think) understood the issue. In my opinion (which is still noobish) there is no risk for confusing events to happen if I use DoEvents as above in the FormClosing event - if there is no way to cancel the closing for the user (like setting e.Cancel = true).
My question: is this a valid method to make sure an application is terminated well and if not, why?