windows - TerminateProcess vs Ctrl+C -


I have a console-mode program that uses SQLite3 to maintain the database file. It takes some time to execute, but it should be secured at any time to cancel it, assuming that the database writes. (This is all under Windows)

To kill Ctrl c in the console compared to any of the consoles, Is anyone safe from the point but another program calls terminetproves?

I have seen that if TerminateProcess is called then I can get database corruption - I think it is because the program does not get the chance to write. My guess is that Ctrl C is better, because the program indicates and kills the OS rather than terminating it.

Note that the program does not actually handle the signal (unless it does not compute); I'm talking about the underlying default mechanism of Win32 executable to handle the Ctrl C signal.

To make the question clear / simple that this writing is currently executed:

  stills (buff, 1024 * 1024, 1, stream); Class = "post-text" itemprop = "text"> 

These are all binding arguments, but the only way to know this is to try it, Wrote a simple program that allocates a 1GB buffer, some data specifies it, and then writes it using a file (fwrite). I tried several ways to write "corrupt" data (especially I was hoping for a small file):

  • Calling TerminusPrice (Pearl's kill function and Win32: :
  • Using Task Manager's "End Process"
  • Using Process Explorer, " Kill the process "

In every case writing will not stop, the file was the correct size and the correct data was. And although "kill" will happen instantly, the process would have been until the writing was completed.

It seems that there is no difference between Terminate Process and Ctrl C to see from the I / O point - once the start of writing It is guaranteed to be completed (excluding electricity outage).


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -