CreateFile() 在 VMWare 上挂起,且磁盘已断开连接。在这种情况下,如何安全地中止 CreateFile 尝试?
我正在调用 CreateFile 打开一个文件,以便在通过 VMWare 运行的外部 Windows 卷上进行读写。但是,如果磁盘因任何原因断开连接(在先前连接之后),CreateFile 将无限期挂起。如何安全地终止 CreateFile 尝试?
我尝试启动一个线程来执行 CreateFile,然后使用 CancelSynchronousIO,但此调用似乎也会无限期地阻塞。据我所知,中止 CreateFile 尝试的唯一方法是使用 TerminateThread,我知道这是一个永远不推荐的混乱选项。在这种情况下 TerminateThread 安全吗?
I am calling CreateFile to open a file for reading and writing on an external Windows volume running over VMWare. However, if the disk is disconnected for any reason (after having been previously connected), CreateFile will hang indefinitely. How can I terminate the CreateFile attempt safely?
I've tried starting a thread to do the CreateFile and then using CancelSynchronousIO, but this call also seems to block indefinitely. As far as I can tell, the only way to abort the CreateFile attempt is with TerminateThread, which I know is a messy option that is never recommended. Is TerminateThread safe to do in this instance?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论