✅ CancellationtokenSource and Cancel Task
Hello Guys, Small question.
If i Cancel a Task with the CancellationtokenSource, I need for other Task's a New CancellationtokenSource?
6 Replies
I'm not sure what you mean by that I'm afraid
You can only cancel a CancellationTokenSource once. Cancelling a CancellationTokenSource will cancel all CancellationTokens created from that TCS
Without knowing the content, I have a small question that could actually answer everything for me:
If I cancel a task with CancellationTokenSource, is the CancellationTokenSource then "used up" and I have to create a new CancellationTokenSource for the next task?
Once you cancel a CancellationTokenSource, you can't un-cancel it
So yes, if you need another, new CancellationToken which isn't cancelled already, you'll need a new CancellationTokenSource
A big, big thank you! You've solved pretty much every problem I have at the moment 😄
Good to hear!
$close
If you have no further questions, please use /close to mark the forum thread as answered