[英]how long it takes for kernel handles to close by Windows when an application crashes
I know Windows close kernel handles when an application crashes, but if I want to wait on this event, can I be sure it will happen in milisec or it might take a while? 我知道Windows关闭内核会在应用程序崩溃时进行处理,但是如果我想等待此事件,可以确定它会在毫秒内发生还是会花费一些时间? I would like to trigger a new function the moment one application is crashed and I'm checking if this handle is NULL but it seems like I can't get a NULL value in this case.
我想在一个应用程序崩溃时触发一个新函数,并且我正在检查此句柄是否为NULL,但在这种情况下似乎无法获得NULL值。
How long it will take may vary depending upon many factors including implementation, type of crash, etc. It might take awhile. 所需的时间可能取决于许多因素,包括实现,崩溃类型等。它可能需要一段时间。
If you want to know when a process has crashed, you should set up a "watchdog" thread or process that waits on the application's Process Handle , using a function such as WaitForSingleObject . 如果您想知道某个进程何时崩溃,则应该使用诸如WaitForSingleObject之类的函数来设置一个“看门狗”线程或等待应用程序的Process Handle的进程 。 When the process dies, the event will be signaled and you can act accordingly.
流程结束后,将发出事件信号,您可以采取相应措施。
Windows does not close handles when an application "crashes" - it closes them when the process terminates, no matter how the process terminates. 当应用程序“崩溃”时,Windows不会关闭句柄-进程终止时,无论进程如何终止,Windows都会关闭句柄。 By the time this happens the variables don't exist any more because the user mode address space has been shut down.
到这种情况发生时,变量已不存在,因为用户模式地址空间已关闭。
What are you trying to do? 你想做什么?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.