[英]How do I Delay destruction of my process if another thread causes it to crash on windows?
I am writing a DLL which is loaded by a proprietary program which is closed source and I have no control over. 我正在编写一个DLL,它由一个专有程序加载,该程序是封闭源代码,我无法控制。 I also load a Proprietary DLL which is just as obscure.
我还加载了一个专有的DLL,这同样模糊不清。 Since I sometimes have to relay commands I get through my DLLs interface to the DLL I Load with very low latency I launch a separate detached thread upon initializing my DLL and send it unformatted debug information through a lock free queue.
由于我有时必须中继命令,我通过我的DLL接口访问DLL I Load,延迟非常低我在初始化DLL时启动一个单独的分离线程,并通过无锁队列发送未格式化的调试信息。 The time consuming formating of debug output and writing to a log file is thus done asynchronously.
因此,耗时的格式化调试输出和写入日志文件是异步完成的。 The problem is that the process crashes inadvertently (which I am almost certain is no my fault) and I have no way of knowing what the last debug info was because my detached thread is killed by windows before it can write it to disk.
问题是进程无意中崩溃(我几乎肯定不是我的错),我无法知道最后的调试信息是什么,因为我的分离线程被Windows杀死之后才能将其写入磁盘。
So here is my question: 所以这是我的问题:
I think even with IPC you would have the situation where your thread may have un-written debug information during a process fault. 我认为即使使用IPC,您也会遇到过程故障期间您的线程可能有未写入的调试信息的情况。 Presumably you don't have debugging going on all the time, so I'd think you wouldn't need a separate thread for it, just a compile-time or run-time option to enable it.
大概你没有调试一直在进行,所以我认为你不需要一个单独的线程,只需要一个编译时或运行时选项来启用它。 You might be able to
SetUnhandledExceptionFilter
for the process and do a few things before you terminate. 您可以为进程设置
SetUnhandledExceptionFilter
,并在终止之前执行一些操作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.