Task cancellation
C#
2
Posts
2
Posters
0
Views
1
Watching
-
Hi, If i just cancel the CancellationTokenSource token (that is a parameter of the Task.Factory.StartNew) , does it cancells automatically the task? or i need to check in the code of the task if the IsCancellationRequested of this cancellationToken and stop the task manually there?
-
Hi, If i just cancel the CancellationTokenSource token (that is a parameter of the Task.Factory.StartNew) , does it cancells automatically the task? or i need to check in the code of the task if the IsCancellationRequested of this cancellationToken and stop the task manually there?
You need code in your Action that checks to see if the IsCancellationRequested property of the token is True.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak