public async Task <TResult> RunAsync(T value, KernelSchedulerDelegate <T, TResult> onExecuteAsync, string scope = "default", CancellationToken cancellationToken = default) { await Task.Yield(); return(await onExecuteAsync(value)); }
public ScheduledOperation( T value, KernelSchedulerDelegate <T, TResult> onExecuteAsync, ExecutionContext executionContext = default, string scope = "default", CancellationToken cancellationToken = default) { Value = value; ExecutionContext = executionContext; _onExecuteAsync = onExecuteAsync; Scope = scope; TaskCompletionSource = new(TaskCreationOptions.RunContinuationsAsynchronously); if (cancellationToken != default) { cancellationToken.Register(() => { TaskCompletionSource.TrySetCanceled(); }); } }
public DeferredOperationSource(KernelSchedulerDelegate <T, TResult> kernelSchedulerOnExecuteAsync, GetDeferredOperationsDelegate getDeferredOperations) { OnExecuteAsync = kernelSchedulerOnExecuteAsync; GetDeferredOperations = getDeferredOperations; }