程序退出时,线程中catch (System.Threading.ThreadAbortException ex)
"unable to evaluate because the code is optimized or a native frame is on top of the call stack."
原因: 是因为线程中有对象因为线程的终止而报的错误. 本例中是因为线程函数中Waitone(),而外部关闭线程,导致异常.
解决方案:关闭线程前,先WaitSet()进行设置,然后再关闭.
"unable to evaluate because the code is optimized or a native frame is on top of the call stack."
原因: 是因为线程中有对象因为线程的终止而报的错误. 本例中是因为线程函数中Waitone(),而外部关闭线程,导致异常.
解决方案:关闭线程前,先WaitSet()进行设置,然后再关闭.
本文探讨了线程中出现System.Threading.ThreadAbortException的原因及其解决办法。异常通常发生在线程使用WaitOne()时被外部强制关闭的情况下。文章提供了一种解决方案:在关闭线程之前先调用WaitSet()来避免此类问题。
1268

被折叠的 条评论
为什么被折叠?



