Thread.Abort() 什么时候不会真正中止?
所以你读了标题,Thread.Abort() 什么时候不会真正中止?我听很多人说这是一个危险的命令,并且永远不能保证它有效,但我实际上从未能够重现这一点。它总是对我有用。
是否有任何特定情况可能导致 Thread.Abort() 持续失败?
So you read the title, when will Thread.Abort() not actually abort? I've heard lots of people say that its a dangerous command and that it is never guaranteed to work, but ive never actually been able to reproduce that. It's always worked for me..
Is there any specific situations that might cause Thread.Abort() to fail consistantly?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您是否阅读过文档?
Did you even read the documentation?
还有一种情况是Thread.Abort()调用没有失败,但是线程没有终止。抛出的ThreadAbortException可以被线程本身捕获。如果确实如此,然后在 catch 处理程序中调用 Thread.ResetAbort(),则不会在 catch 块末尾重新引发 ThreadAbortException。
There is also a situation where the Thread.Abort() call does not fail, but the thread does not terminate. The ThreadAbortException that is thrown can be caught by the thread itself. If it does and then calls Thread.ResetAbort() within the catch handler, the ThreadAbortException will not be rethrown at the end of the catch block.