4 ms·
In .Net, use CancellationToken ( https://learn.microsoft.com/en-us/dotnet/api/system.threading.cancellationtoken?view=net-8.0 https://learn.microsoft.com/en-us/
by maxlybbert 2y ago
In .Net, use CancellationToken ( https://learn.microsoft.com/en-us/dotnet/api/system.threading.cancellationtoken?view=net-8.0 https://learn.microsoft.com/en-us/dotnet/api/system.threadin... , https://learn.microsoft.com/en-us/dotnet/api/system.threading.cancellationtokensource?view=net-8.0 https://learn.microsoft.com/en-us/dotnet/api/system.threadin... ).
The two big benefits are (1) if you pass the cancellation token to the task that might be canceled, hopefully it will be obvious that the task might be canceled; and (2) the task that might be canceled has a way to find out it’s being canceled and, if that ever happens, it can clean up.
- Alifatisk 2y agoAnd in Rubys case?