TINMAN 3D / REALTIME TERRAIN
Software Development Kit - User Manual

class Task in Tinman.Core.Threading.Pooling

abstract class Task with <TInput>  
  <TOutput>  
  implements ITask<TInput, TOutput>
  extends TaskBase

Public / Attributes

Flags

The task flags.

public property Flags { get }
type TaskFlags
value The task flags.
inherited TaskBase.Flags

Group

The group this task belongs to.

public property Group { get set }
type TaskGroup
value The task group or null to use the default task group.
inherited TaskBase.Group

Name

Human-readable name of this task.

public property Name { get }
type string
value [not-null] The task name.
inherited TaskBase.Name

Remarks:

The name is primarily used for error reporting.

OnCancel

The task cancel delegate to use.

public property OnCancel { get set }
type TaskCancelDelegate<TInput>
value The task cancel delegate or null.
implements ITask.OnCancel

Remarks:

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

OnException

The task exception delegate to use.

public property OnException { get set }
type TaskExceptionDelegate<TInput>
value The task exception delegate or null.
implements ITask.OnException

Remarks:

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

Public / Methods

PerformTask

Performs the actual task work.

public abstract method PerformTask (TInput input)
type TOutput
params input The input data.
returns The task output data object.
implements ITask.PerformTask

Queue

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

public method Queue (bool throwOnCancel = true, bool ordered = false, int32 n = 16)
type ITaskQueue<TInput, TOutput>
params throwOnCancel Throw a PoolingException if the task has been cancelled? Defaults to true.
  ordered Return output values (see Pop) in same order as input values (see Push)? When set to false, the caller is responsible to mapping outputs to their inputs. Defaults to false.
  n [>=-1] The maximum number of pending task invocations. When the maximum number has been reached, the next call to Push will block until another thread calls Pop. Set to -1 to disable blocking (the queue will just grow then). Defaults to 16.
returns [not-null] The task queue.
implements ITask.Queue

Schedule

Schedules this task for execution using the given input data.

[ThreadSafe]
public method Schedule (TInput input, TaskGroup group = null, TaskCancelDelegate<TInput> onCancel = null, TaskExceptionDelegate<TInput> onException = null)
type TaskResult<TOutput>
params input The input data object.
  group Optional task group (will override Group if not null). Defaults to null.
  onCancel Optional delegate to call when the task is cancelled (will override OnCancel if not null). Defaults to null.
  onException Optional task exception callback delegate (will override OnException if not null). Defaults to null.
returns [not-null] The task result object.
implements ITask.Schedule

Wrap

Wraps the given task delegate method in a ITask object.

public static method Wrap (TaskDelegate<TInput, TOutput> method, string name = "unnamed-task", TaskFlags flags = TaskFlags.None, TaskGroup group = null, TaskCancelDelegate<TInput> onCancel = null, TaskExceptionDelegate<TInput> onException = null)
type ITask<TInput, TOutput>
params method [not-null] The task delegate method.
  name [not-null] The task name. This is usually the name of the method pointed to by method, without the Task prefix.
  flags The task flags.
  group The default task group. Defaults to null.
  onCancel The default on cancel delegate. Defaults to null.
  onException The default on exception delegate. Defaults to null.
returns [not-null] The task object.

Protected / Constructors

Task

Creates a new instance of Task.

protected constructor Task (string name, TaskFlags flags)
params name [not-null] The task name.
  flags The task flags.