开发者

What is the correct way to end a System.Threading.Tasks.Task?

开发者 https://www.devze.com 2023-03-21 00:54 出处:网络
As per the title really. I have a long running task tha开发者_JS百科t polls a message queue. Occasionally I may wish to stop the task, do some work and then start it again. What is the correct way o

As per the title really.

I have a long running task tha开发者_JS百科t polls a message queue.

Occasionally I may wish to stop the task, do some work and then start it again. What is the correct way of doing this?


The proper way of stooping tasks is using cancellation tokens.

0

精彩评论

暂无评论...
验证码 换一张
取 消