0

Windows Mobile 6.5

I have a process which uses System.Threading.Timer upload some data to net at specified intervals.

Now I want to terminate this process from a GUI application. I can use process enumerator to get Process object. What happens when I call Process.Kill? Does it jsut terminate it, the process could be in the middle of reading/deleting data from local database and sending it to service. What can I do make sure that atleast if its in middle it does not terminate and once it is done it can terminate before next Timer event fires?

ASR
  • 429
  • 3
  • 6
  • 16

1 Answers1

2

Terminating an application like that cuts it off at the knees, introducing the distinct possibility of corrupting data. The only way around that is to not terminate the process.

You'll have to introduce a way to communicate to the application that it need to exit so that it can finish whatever it's doing so data won't be corrupted.

i.e. the application must be written in a way to accept a request like that (however you want to do it).

Peter Ritchie
  • 35,463
  • 9
  • 80
  • 98