Table of Contents

Class TasksManager<TResult>

Namespace
Common
Assembly
Lykke.Common.dll

Helps working with a collection of tasks and perform group operations with them.

public sealed class TasksManager<TResult>

Type Parameters

TResult

A result type

Inheritance
TasksManager<TResult>
Inherited Members
Extension Methods

Constructors

TasksManager()

public TasksManager()

Methods

Add(object, CancellationToken)

Creates a new task and add it into the internal collection

public Task<TResult> Add(object key, CancellationToken cancellationToken = default)

Parameters

key object

A key

cancellationToken CancellationToken

An optional cancellation token. Can be used to set the task into the canceled state

Returns

Task<TResult>

The created task

Cancel(object, CancellationToken)

Attempts to transition the task into the Canceled state.

public void Cancel(object key, CancellationToken cancellationToken = default)

Parameters

key object

A key of the task

cancellationToken CancellationToken

Optional cancellation token

CancelAll(CancellationToken)

Attempts to transition all tasks into the Canceled state.

public void CancelAll(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

An optional cancellation token

SetExceptionsToAll(Exception)

Attempts to transition all tasks into the Faulted state.

public void SetExceptionsToAll(Exception exception)

Parameters

exception Exception

An exception to set in to task

SetResult(object, TResult)

Attempts to transition the task into the RanToCompletion state.

public void SetResult(object key, TResult result)

Parameters

key object

The task key

result TResult

The result to set into the task