请注意:本页内容发布于 2224 天前,内容可能已经过时,请注意甄别。
算了算了,我不管你了。
原文链接:https://blogs.msdn.microsoft.com/oldnewthing/20031216-00/?p=41483
In a comment, somebody asked what the deal was with the unsafe device removal dialog in Windows 2000 and why it’s gone in Windows XP.
在某则评论中,有人提问Windows 2000中的『不安全设备删除』对话框相关的事情,以及为什么到了Windows XP这个对话框又被移除了。
I wasn’t involved with that dialog, but here’s what I remember: The device was indeed removed unsafely. If it was a USB storage device, for example, there may have been unflushed I/O buffers. If it were a printer, there may have been an active print job. The USB stack doesn’t know for sure (those are concepts at a higher layer that the stack doesn’t know about) – all it knows is that it had an active channel with the device and now the device is gone, so it gets upset and yells at you.
我没有参与那个对话框的设计工作,不过我所记得的是:相关设备的确被以不安全的方式移除了。例如,如果是一个USB存储设备,可能I/O缓存中还存在尚未完成处理的数据;如果是台打印机,可能有正在进行的打印任务。USB协议栈对此并不确切明了(这些相关的信息是由更高层次的机制处理的,协议栈并不了解)——协议栈所知的只是刚刚与这台设备还有个活动的数据通道,然后现在设备却不见了,所以它会急得跳起脚来,对用户大喊大叫。
In Windows XP, it still gets upset but it now keeps its mouth shut. You’re now on your honor not to rip out your USB drive before waiting two seconds for all I/O to flush, not to unplug your printer while a job is printing, etc. If you do, then your drive gets corrupted / print job is lost / etc. and you’re on your own.
而在Windows XP中,协议栈仍然会对此深表不满,但会选择一言不发。现在你必须自行承担不等最后两秒钟、让缓冲区里的数据被处理完之前不要拔掉你的U盘,或者正在打印时不要把打印机扯掉之类的事情的后果。真要是这么做了,那么你就要面对的U盘就会坏掉、打印任务丢失之类的事情,并自行承担相应的后果。
远嚣 Comment