【问题标题】:Is there any possible way to avoid ThreadAbortException when using thread.abort() method?使用 thread.abort() 方法时是否有任何可能的方法来避免 ThreadAbortException?
【发布时间】:2016-01-06 16:55:23
【问题描述】:

我创建了多个线程。它正在做一些大任务。一些之后,我中止了所有线程,但有时它会引发 threadabortexception。我想避免它发生。

【问题讨论】:

  • Not 使用Thread.Abort 可以很好地避免ThreadAbortException。在大量大多数用例中,线程信号和协作取消是更好的选择。
  • 关于该主题的大量文章。这是一个:blogs.msmvps.com/peterritchie/2007/08/22/…

标签: c# multithreading threadabortexception


【解决方案1】:

不,没有。这就是线程中止的工作原理。

不要中止线程。以合作的、明确的方式终止它。线程中止会导致各种令人讨厌的问题。

【讨论】:

    猜你喜欢
    • 2020-11-12
    • 1970-01-01
    • 1970-01-01
    • 2016-01-21
    • 1970-01-01
    • 1970-01-01
    • 2020-09-19
    • 1970-01-01
    • 2018-02-05
    相关资源
    最近更新 更多