.NET: Clean up some CancellationToken usage (#996)

* Clean up some CancellationToken usage

* Unused usings
This commit is contained in:
Stephen Toub
2025-09-30 13:44:53 +00:00
committed by GitHub
parent 53eb48968d
commit 4fd61924fc
35 changed files with 191 additions and 191 deletions
@@ -68,7 +68,7 @@ public class RepresentationTests
testsRun++;
}
async ValueTask MessageHandlerAsync(int message, IWorkflowContext workflowContext, CancellationToken cancellation = default)
async ValueTask MessageHandlerAsync(int message, IWorkflowContext workflowContext, CancellationToken cancellationToken = default)
{
}
}
@@ -113,12 +113,12 @@ internal sealed class JudgeExecutor : ReflectingExecutor<JudgeExecutor>, IMessag
NumberSignal.Above;
}
protected internal override ValueTask OnCheckpointingAsync(IWorkflowContext context, CancellationToken cancellation = default)
protected internal override ValueTask OnCheckpointingAsync(IWorkflowContext context, CancellationToken cancellationToken = default)
{
return context.QueueStateUpdateAsync("TryCount", this.Tries);
}
protected internal override async ValueTask OnCheckpointRestoredAsync(IWorkflowContext context, CancellationToken cancellation = default)
protected internal override async ValueTask OnCheckpointRestoredAsync(IWorkflowContext context, CancellationToken cancellationToken = default)
{
this.Tries = await context.ReadStateAsync<int?>("TryCount").ConfigureAwait(false) ?? 0;
}
@@ -41,7 +41,7 @@ internal static class Step5EntryPoint
{
await handle.EndRunAsync().ConfigureAwait(false);
checkpointed = await InProcessExecution.ResumeStreamAsync(workflow, targetCheckpoint, checkpointManager, runId: handle.RunId, cancellation: CancellationToken.None)
checkpointed = await InProcessExecution.ResumeStreamAsync(workflow, targetCheckpoint, checkpointManager, runId: handle.RunId, cancellationToken: CancellationToken.None)
.ConfigureAwait(false);
handle = checkpointed.Run;
}
@@ -25,12 +25,12 @@ internal abstract class TestingExecutor<TIn, TOut> : Executor, IDisposable
this._actions = actions;
}
public void UnlinkCancellation(CancellationToken token) =>
this._linkedTokens.Remove(token);
public void UnlinkCancellation(CancellationToken cancellationToken) =>
this._linkedTokens.Remove(cancellationToken);
public void LinkCancellation(CancellationToken token)
public void LinkCancellation(CancellationToken cancellationToken)
{
this._linkedTokens.Add(token);
this._linkedTokens.Add(cancellationToken);
CancellationTokenSource tokenSource = CancellationTokenSource.CreateLinkedTokenSource(this._linkedTokens.ToArray());
tokenSource = Interlocked.Exchange(ref this._internalCts, tokenSource);
tokenSource.Dispose();