The workaround you link to is too complicated, and, much more importantly, not thread safe!
I worked around this by setting a bool that indicates whether threads in infinite loops should exit. Then, when an exit is requested, I set the bool, call System.Windows.Forms.Form.Close() and then Application.Exit(). The form closes immediately, but the application won't exit until all the threads die. But that's only a problem if the user tries to restart the application before the other threads actually exit...
1 comment:
I came across this too.
The workaround you link to is too complicated, and, much more importantly, not thread safe!
I worked around this by setting a bool that indicates whether threads in infinite loops should exit. Then, when an exit is requested, I set the bool, call System.Windows.Forms.Form.Close() and then Application.Exit(). The form closes immediately, but the application won't exit until all the threads die. But that's only a problem if the user tries to restart the application before the other threads actually exit...
Post a Comment