如何中止/取消 TPL 任務? - How do I abort/cancel TPL Tasks?

問題:

In a thread, I create some System.Threading.Task and start each task.在一個線程中,我創建了一些System.Threading.Task並啓動每個任務。

When I do a .Abort() to kill the thread, the tasks are not aborted.當我執行.Abort()來終止線程時,任務不會中止。

How can I transmit the .Abort() to my tasks ?如何將.Abort()傳輸到我的任務?


解決方案:

參考一: https://en.stackoom.com/question/K4V7
參考二: https://stackoom.com/question/K4V7
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章