I have a console-mode program that uses SQLite3 to maintain a database file. It takes a while to execute, but it should be safe at any point to cancel, assuming that the database writes happen. (This is all under Windows)
Is it any safer, from the point of a running program, to hit CTRL+C in the console than to have another program call TerminateProcess on it?
I've noticed that I can get database corruption if TerminateProcess is called- I assume that this is because the program does not get a chance to finish writes. My guess is that CTRL+C is better, because the program gets a signal and terminates itself, rather than the OS killing it.
Note that the program doesn't actually handle the signal (unless SQLite does); I'm talking about the built-in default mechanisms of Win32 executables to handle the CTRL+C signal.
To clarify/simplify the question- given that this write has just executed:
fwrite(buf, 1024*1024, 1, stream);
During this write, will TerminateProcess behave differently from CTRL+C?