I have a destructor that needs to be called even if the program is improperly terminated in order to ensure that an external process dies.
Currently I have registered the destructor to be called by
std::atexit(killprocess);
std::at_quick_exit(killprocess);
however this means that when the program is finished but not terminated the process isn't killed. Is there some way to ensure that either killprocess or the destructor is called either at exit or when the program is finished but not terminated?
Edit: The finished but not terminated state is from visual studio that adds a wait condition at the end. I believe this means that having registered killprocess with atexit the process destructor isn't naturally called by this point in the execution