Class LocalTaskRunner
TaskRunner that you can 'tick' manually.
Inheritance
System.Object
LocalTaskRunner
Implements
System.IDisposable
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ToString()
System.Object.ReferenceEquals(System.Object, System.Object)
Assembly: cs.temp.dll.dll
Syntax
public sealed class LocalTaskRunner : ITaskRunner, IDisposable
Constructors
LocalTaskRunner(IExceptionHandler)
Declaration
public LocalTaskRunner(IExceptionHandler exceptionHandler)
Parameters
Type |
Name |
Description |
IExceptionHandler |
exceptionHandler |
Handler to use when exception occur in tasks.
|
Methods
AssertRunningTaskCount(Int32)
Valid in 'DEBUG' only, useful for tests.
Declaration
public void AssertRunningTaskCount(int expectedCount)
Parameters
Type |
Name |
Description |
System.Int32 |
expectedCount |
|
Dispose()
Declaration
Execute()
Execute all the work that was 'scheduled' by the tasks running on this runner.
Declaration
StartTask(Func<CancellationToken, Task>)
Start a task on this runner.
that is passed to the task-creator is cancelled when the
runner is disposed, this can be usefull for cancelling external processes.
Declaration
public Task StartTask(Func<CancellationToken, Task> taskCreator)
Parameters
Type |
Name |
Description |
System.Func<CancellationToken, System.Threading.Tasks.Task> |
taskCreator |
Function for creating the task.
|
Returns
Type |
Description |
System.Threading.Tasks.Task |
Task that completes when the original task completes or when the runner gets disposed.
|
Exceptions
StartTask(Func<CancellationToken, Task>, IDiagnosticLogger)
Declaration
public Task StartTask(Func<CancellationToken, Task> taskCreator, IDiagnosticLogger logger)
Parameters
Type |
Name |
Description |
System.Func<CancellationToken, System.Threading.Tasks.Task> |
taskCreator |
|
IDiagnosticLogger |
logger |
Optional logger to output diagnostic messages to.
|
Returns
Type |
Description |
System.Threading.Tasks.Task |
|
StartTask(Func<Task>)
Start a task on this runner.
Declaration
public Task StartTask(Func<Task> taskCreator)
Parameters
Type |
Name |
Description |
System.Func<System.Threading.Tasks.Task> |
taskCreator |
Function for creating the task.
|
Returns
Type |
Description |
System.Threading.Tasks.Task |
Task that completes when the original task completes or when the runner gets disposed.
|
Exceptions
StartTask(Func<Task>, IDiagnosticLogger)
Declaration
public Task StartTask(Func<Task> taskCreator, IDiagnosticLogger logger)
Parameters
Type |
Name |
Description |
System.Func<System.Threading.Tasks.Task> |
taskCreator |
|
IDiagnosticLogger |
logger |
Optional logger to output diagnostic messages to.
|
Returns
Type |
Description |
System.Threading.Tasks.Task |
|
StartTask<TIn>(Func<TIn, CancellationToken, Task>, TIn)
Declaration
public Task StartTask<TIn>(Func<TIn, CancellationToken, Task> taskCreator, TIn data)
Parameters
Type |
Name |
Description |
System.Func<TIn, CancellationToken, System.Threading.Tasks.Task> |
taskCreator |
|
TIn |
data |
|
Returns
Type |
Description |
System.Threading.Tasks.Task |
|
Type Parameters
StartTask<TIn>(Func<TIn, CancellationToken, Task>, TIn, IDiagnosticLogger)
Declaration
public Task StartTask<TIn>(Func<TIn, CancellationToken, Task> taskCreator, TIn data, IDiagnosticLogger logger)
Parameters
Type |
Name |
Description |
System.Func<TIn, CancellationToken, System.Threading.Tasks.Task> |
taskCreator |
|
TIn |
data |
|
IDiagnosticLogger |
logger |
Optional logger to output diagnostic messages to.
|
Returns
Type |
Description |
System.Threading.Tasks.Task |
|
Type Parameters
StartTask<TIn>(Func<TIn, Task>, TIn)
Declaration
public Task StartTask<TIn>(Func<TIn, Task> taskCreator, TIn data)
Parameters
Type |
Name |
Description |
System.Func<TIn, System.Threading.Tasks.Task> |
taskCreator |
|
TIn |
data |
|
Returns
Type |
Description |
System.Threading.Tasks.Task |
|
Type Parameters
StartTask<TIn>(Func<TIn, Task>, TIn, IDiagnosticLogger)
Declaration
public Task StartTask<TIn>(Func<TIn, Task> taskCreator, TIn data, IDiagnosticLogger logger)
Parameters
Type |
Name |
Description |
System.Func<TIn, System.Threading.Tasks.Task> |
taskCreator |
|
TIn |
data |
|
IDiagnosticLogger |
logger |
Optional logger to output diagnostic messages to.
|
Returns
Type |
Description |
System.Threading.Tasks.Task |
|
Type Parameters
StartTask<TOut>(Func<CancellationToken, Task<TOut>>)
Declaration
public Task<TOut> StartTask<TOut>(Func<CancellationToken, Task<TOut>> taskCreator)
Parameters
Type |
Name |
Description |
System.Func<CancellationToken, System.Threading.Tasks.Task<TOut>> |
taskCreator |
|
Returns
Type |
Description |
System.Threading.Tasks.Task<TOut> |
|
Type Parameters
StartTask<TOut>(Func<CancellationToken, Task<TOut>>, IDiagnosticLogger)
Declaration
public Task<TOut> StartTask<TOut>(Func<CancellationToken, Task<TOut>> taskCreator, IDiagnosticLogger logger)
Parameters
Type |
Name |
Description |
System.Func<CancellationToken, System.Threading.Tasks.Task<TOut>> |
taskCreator |
|
IDiagnosticLogger |
logger |
Optional logger to output diagnostic messages to.
|
Returns
Type |
Description |
System.Threading.Tasks.Task<TOut> |
|
Type Parameters
StartTask<TOut>(Func<Task<TOut>>)
Declaration
public Task<TOut> StartTask<TOut>(Func<Task<TOut>> taskCreator)
Parameters
Type |
Name |
Description |
System.Func<System.Threading.Tasks.Task<TOut>> |
taskCreator |
|
Returns
Type |
Description |
System.Threading.Tasks.Task<TOut> |
|
Type Parameters
StartTask<TOut>(Func<Task<TOut>>, IDiagnosticLogger)
Declaration
public Task<TOut> StartTask<TOut>(Func<Task<TOut>> taskCreator, IDiagnosticLogger logger)
Parameters
Type |
Name |
Description |
System.Func<System.Threading.Tasks.Task<TOut>> |
taskCreator |
|
IDiagnosticLogger |
logger |
Optional logger to output diagnostic messages to.
|
Returns
Type |
Description |
System.Threading.Tasks.Task<TOut> |
|
Type Parameters
StartTask<TIn, TOut>(Func<TIn, CancellationToken, Task<TOut>>, TIn)
Declaration
public Task<TOut> StartTask<TIn, TOut>(Func<TIn, CancellationToken, Task<TOut>> taskCreator, TIn data)
Parameters
Type |
Name |
Description |
System.Func<TIn, CancellationToken, System.Threading.Tasks.Task<TOut>> |
taskCreator |
|
TIn |
data |
|
Returns
Type |
Description |
System.Threading.Tasks.Task<TOut> |
|
Type Parameters
Name |
Description |
TIn |
|
TOut |
|
StartTask<TIn, TOut>(Func<TIn, CancellationToken, Task<TOut>>, TIn, IDiagnosticLogger)
Declaration
public Task<TOut> StartTask<TIn, TOut>(Func<TIn, CancellationToken, Task<TOut>> taskCreator, TIn data, IDiagnosticLogger logger)
Parameters
Type |
Name |
Description |
System.Func<TIn, CancellationToken, System.Threading.Tasks.Task<TOut>> |
taskCreator |
|
TIn |
data |
|
IDiagnosticLogger |
logger |
Optional logger to output diagnostic messages to.
|
Returns
Type |
Description |
System.Threading.Tasks.Task<TOut> |
|
Type Parameters
Name |
Description |
TIn |
|
TOut |
|
StartTask<TIn, TOut>(Func<TIn, Task<TOut>>, TIn)
Declaration
public Task<TOut> StartTask<TIn, TOut>(Func<TIn, Task<TOut>> taskCreator, TIn data)
Parameters
Type |
Name |
Description |
System.Func<TIn, System.Threading.Tasks.Task<TOut>> |
taskCreator |
|
TIn |
data |
|
Returns
Type |
Description |
System.Threading.Tasks.Task<TOut> |
|
Type Parameters
Name |
Description |
TIn |
|
TOut |
|
StartTask<TIn, TOut>(Func<TIn, Task<TOut>>, TIn, IDiagnosticLogger)
Declaration
public Task<TOut> StartTask<TIn, TOut>(Func<TIn, Task<TOut>> taskCreator, TIn data, IDiagnosticLogger logger)
Parameters
Type |
Name |
Description |
System.Func<TIn, System.Threading.Tasks.Task<TOut>> |
taskCreator |
|
TIn |
data |
|
IDiagnosticLogger |
logger |
Optional logger to output diagnostic messages to.
|
Returns
Type |
Description |
System.Threading.Tasks.Task<TOut> |
|
Type Parameters
Name |
Description |
TIn |
|
TOut |
|
Implements
System.IDisposable