ITask

Description

interface Tinman.Core.Threading.Pooling.ITask
<TInput>
<TOutput>

Derived from

ITaskBase

Extended by

Task abstract

Base interface for one-time background tasks.

Public / Methods

Perform​Task


[ThrowAny]
public method PerformTask → (1)

input in : TInput

The input data.

returns → TOutput

The task output data object.

Performs the actual task work.

If this method throws an exception, it will be wrapped; a PoolingException will then be thrown when TaskResult.Finish is called.

Queue


public method Queue → (3)

throwOnCancel opt : bool = true

Throw a PoolingException if the task has been cancelled?

ordered opt : bool = false

Return output values (see ITaskQueue.Pop) in same order as input values (see ITaskQueue.Push)? When set to false, the caller is responsible to mapping outputs to their inputs.

opt : int32 = 16

[>=-1]
The maximum number of pending task invocations. When the maximum number has been reached, the next call to ITaskQueue.Push will block until another thread calls ITaskQueue.Pop. Set to -1 to disable blocking (the queue will just grow then).

returns → ITaskQueue<TInput, TOutput>

The task queue.

Returns a queue that can be used to repeatedly invoke this task.

Schedule


[ThreadSafe]
public method Schedule → (4)

input in : TInput

The input data object.

group opt : TaskGroup = null

Optional task group (will override ITaskBase.Group if not null).

onCancel opt : TaskCancelDelegate<TInput> = null

Optional delegate to call when the task is cancelled (will override OnCancel if not null).

onException opt : TaskExceptionDelegate<TInput> = null

Optional task exception callback delegate (will override OnException if not null).

returns → TaskResult<TOutput>

The task result object.

Schedules this task for execution using the given input data.

Public / Attributes

On​Cancel


public attribute OnCancel → (get,set)

value : TaskCancelDelegate<TInput>

The task cancel delegate or null.

The task cancel delegate to use.

This is the default cancel delegate. It can optionally be overwritten when this task is scheduled.

On​Exception


public attribute OnException → (get,set)

value : TaskExceptionDelegate<TInput>

The task exception delegate or null.

The task exception delegate to use.

This is the default exception delegate. It can optionally be overwritten when this task is scheduled.