annotate Implab/Components/IRunnable.cs @ 250:9f63dade3a40 v3

Working on runnable component
author cin
date Thu, 01 Feb 2018 02:43:35 +0300
parents 7d07503621fe
children 7c7e9ad6fe4a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
152
240aa6994018 component model refactoring
cin
parents:
diff changeset
1 using System;
250
9f63dade3a40 Working on runnable component
cin
parents: 208
diff changeset
2 using System.Threading;
9f63dade3a40 Working on runnable component
cin
parents: 208
diff changeset
3 using System.Threading.Tasks;
152
240aa6994018 component model refactoring
cin
parents:
diff changeset
4
240aa6994018 component model refactoring
cin
parents:
diff changeset
5 namespace Implab.Components {
250
9f63dade3a40 Working on runnable component
cin
parents: 208
diff changeset
6 /// <summary>
9f63dade3a40 Working on runnable component
cin
parents: 208
diff changeset
7 /// Interface for the component which performs a long running task.
208
7d07503621fe RunnableComponent.Dispose(bool,Exception) changed to standart Dispose(bool)
cin
parents: 205
diff changeset
8 /// </summary>
7d07503621fe RunnableComponent.Dispose(bool,Exception) changed to standart Dispose(bool)
cin
parents: 205
diff changeset
9 public interface IRunnable : IDisposable {
203
4d9830a9bbb8 Added 'Fail' method to RunnableComponent which allows component to move from
cin
parents: 152
diff changeset
10 /// <summary>
208
7d07503621fe RunnableComponent.Dispose(bool,Exception) changed to standart Dispose(bool)
cin
parents: 205
diff changeset
11 /// Starts this instance
203
4d9830a9bbb8 Added 'Fail' method to RunnableComponent which allows component to move from
cin
parents: 152
diff changeset
12 /// </summary>
250
9f63dade3a40 Working on runnable component
cin
parents: 208
diff changeset
13 void Start(CancellationToken ct);
152
240aa6994018 component model refactoring
cin
parents:
diff changeset
14
203
4d9830a9bbb8 Added 'Fail' method to RunnableComponent which allows component to move from
cin
parents: 152
diff changeset
15 /// <summary>
250
9f63dade3a40 Working on runnable component
cin
parents: 208
diff changeset
16 /// Stops this instance and releases all resources, after the instance is stopped it is moved to Disposed state and can't be reused.
203
4d9830a9bbb8 Added 'Fail' method to RunnableComponent which allows component to move from
cin
parents: 152
diff changeset
17 /// </summary>
250
9f63dade3a40 Working on runnable component
cin
parents: 208
diff changeset
18 void Stop(CancellationToken ct);
9f63dade3a40 Working on runnable component
cin
parents: 208
diff changeset
19
9f63dade3a40 Working on runnable component
cin
parents: 208
diff changeset
20 Task<ExecutionState> Completion { get; }
152
240aa6994018 component model refactoring
cin
parents:
diff changeset
21
240aa6994018 component model refactoring
cin
parents:
diff changeset
22 ExecutionState State { get; }
240aa6994018 component model refactoring
cin
parents:
diff changeset
23
205
8200ab154c8a Added ResetState to RunnableComponent to reset in case of failure
cin
parents: 203
diff changeset
24 event EventHandler<StateChangeEventArgs> StateChanged;
8200ab154c8a Added ResetState to RunnableComponent to reset in case of failure
cin
parents: 203
diff changeset
25
152
240aa6994018 component model refactoring
cin
parents:
diff changeset
26 Exception LastError { get; }
240aa6994018 component model refactoring
cin
parents:
diff changeset
27 }
240aa6994018 component model refactoring
cin
parents:
diff changeset
28 }
240aa6994018 component model refactoring
cin
parents:
diff changeset
29