Can't find Abort method in Thread

末鹿安然 提交于 2020-01-10 01:06:08

问题


I'm porting a project to .NET Core and have some logic with the method. Do you know .NET Core supports Abort() method in Thread class?


回答1:


Thread.Abort has been removed in .NET Core.

  • Move Thread.Abort under FEATURE_LEGACYSURFACE https://github.com/dotnet/coreclr/pull/2342
  • Never call Thread.Abort https://github.com/aspnet/KestrelHttpServer/pull/726
  • for tests purpose the custom Abort Ext method is used



回答2:


As far as I have understood so far it is now recommended to use CancellationToken. Please read more about how to use this here:

https://msdn.microsoft.com/en-us/library/dd997364(v=vs.110).aspx



来源:https://stackoverflow.com/questions/39243016/cant-find-abort-method-in-thread

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!