开发者

Win32 API TerminateProcess() clarification with pending I/O operations which are cancelled or completed

According to http://msdn.microsoft.com/en-us/library/ms686714(VS.85).aspx:

TerminateProcess initiates termination and returns immediately. This stops execution of all threads within the process and requests cancellation of all pending I/O. The terminated 开发者_开发知识库process cannot exit until all pending I/O has been completed or canceled.

In my application, sometimes I need to forcibly kill a process that enters a bad state. I am using Lucene for indexing, and the statement above worries me that although Lucene is designed to be tolerant to crashes, if I/O operations can be "canceled" rather than "completed", this indicates to me an index could still be corrupted.

Can anyone shed any more light on when/if an I/O operation can be cancelled?


I am reading

This [...] requests cancellation of all pending I/O. The terminated process cannot exit until all pending I/O has been completed or canceled.

as

This [...] requests cancellation of all pending I/O. The terminated process cannot exit until all pending I/O has been canceled. Some pending I/O may complete slightly before it would have been canceled.

I would therefor expect the complete range of any to all pending I/O to complete.

If you want to "forcibly kill a process that enters a bad state" you cannot expect that the application state/data will be left in a good state.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜