Is it possible to create a separate thread on application exit that will continue to run (after the application closes) until the thread finishes its work?
I’m using C# and I have a case where I want to exit an application but at the same time kick off database interaction that will fire off stored procedures. My problem is that I can have a variable number of Stored Procs to execute, but I do not want to cause the application to hang or be slow to exit.
What does “application exit” mean? By definition, when the application really really exits, all its threads exit, too.
Maybe you want to start a new thread just when the UI is closed? So that the user thinks that the application is exited, because there is no visible UI, whereas the application still runs in the background? Yes, this is possible, but you need to tell us which UI framework are you using. (WinForms? WPF?)