Base interface for one-time background tasks.
interface
|
ITask
|
with
|
<TInput>
|
||
<TOutput>
|
|||||
extends
|
ITaskBase
|
||||
base of
|
Task
|
The task flags.
property
|
Flags
{
get
}
|
||
type
|
TaskFlags
|
||
value
|
The task flags. | ||
inherited
|
ITaskBase.Flags
|
The group this task belongs to.
property
|
Group
{
get
set
}
|
||
type
|
TaskGroup
|
||
value
|
The
task
group
or
null
to
use
the
default
task
group. |
||
inherited
|
ITaskBase.Group
|
Human-readable name of this task.
property
|
Name
{
get
}
|
||
type
|
string
|
||
value
|
|
The task name. | |
inherited
|
ITaskBase.Name
|
Remarks:
The name is primarily used for error reporting.
The task cancel delegate to use.
property
|
OnCancel
{
get
set
}
|
||
type
|
TaskCancelDelegate<TInput>
|
||
value
|
The
task
cancel
delegate
or
null . |
Remarks:
This is the default cancel delegate. It can optionally be overwritten when this task is scheduled.
The task exception delegate to use.
property
|
OnException
{
get
set
}
|
||
type
|
TaskExceptionDelegate<TInput>
|
||
value
|
The
task
exception
delegate
or
null . |
Remarks:
This is the default exception delegate. It can optionally be overwritten when this task is scheduled.
Performs the actual task work.
method
|
PerformTask
(TInput input)
|
||
type
|
TOutput
|
||
params
|
input
|
The input data. | |
returns
|
The task output data object. |
Returns a queue that can be used to repeatedly invoke this task.
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
|
|
The task queue. |
Schedules this task for execution using the given input data.
[ThreadSafe]
|
||||
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
|
|
The task result object. |