Class TaskCancellationManager
A class to handle managing cancellation tokens for tasks.
Implements
Inherited Members
Namespace: Microsoft.Internal.Studios.Aruba.Infrastructure
Assembly: Aruba.Infrastructure.dll
Syntax
public class TaskCancellationManager : IDisposable
Properties
View SourceIsTaskRunning
Gets a value indicating whether the task is currently running.
Declaration
public bool IsTaskRunning { get; }
Property Value
Type | Description |
---|---|
bool |
Methods
View SourceBeginTaskAsync(Func<CancellationToken, Task>)
Begins a new task.
Declaration
public Task BeginTaskAsync(Func<CancellationToken, Task> task)
Parameters
Type | Name | Description |
---|---|---|
Func<CancellationToken, Task> | task | A function that represents the task to run, which returns an awaitable Task and takes a cancellation token to cancel the operation. |
Returns
Type | Description |
---|---|
Task | An awaitable task. |
CancelTask()
Cancels a task if there is already one in progress.
Declaration
public void CancelTask()
CancelTaskAsync()
Cancels a task if there is already one in progress, and waits for the task to finish cancelling.
Declaration
public Task CancelTaskAsync()
Returns
Type | Description |
---|---|
Task | A Task representing the asynchronous operation |
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
public void Dispose()