Mercurial > pub > ImplabNet
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 | 
| rev | line source | 
|---|---|
| 152 | 1 using System; | 
| 250 | 2 using System.Threading; | 
| 3 using System.Threading.Tasks; | |
| 152 | 4 | 
| 5 namespace Implab.Components { | |
| 250 | 6 /// <summary> | 
| 7 /// Interface for the component which performs a long running task. | |
| 208 
7d07503621fe
RunnableComponent.Dispose(bool,Exception) changed to standart Dispose(bool)
 cin parents: 
205diff
changeset | 8 /// </summary> | 
| 
7d07503621fe
RunnableComponent.Dispose(bool,Exception) changed to standart Dispose(bool)
 cin parents: 
205diff
changeset | 9 public interface IRunnable : IDisposable { | 
| 203 
4d9830a9bbb8
Added 'Fail' method to RunnableComponent which allows component to move from
 cin parents: 
152diff
changeset | 10 /// <summary> | 
| 208 
7d07503621fe
RunnableComponent.Dispose(bool,Exception) changed to standart Dispose(bool)
 cin parents: 
205diff
changeset | 11 /// Starts this instance | 
| 203 
4d9830a9bbb8
Added 'Fail' method to RunnableComponent which allows component to move from
 cin parents: 
152diff
changeset | 12 /// </summary> | 
| 250 | 13 void Start(CancellationToken ct); | 
| 152 | 14 | 
| 203 
4d9830a9bbb8
Added 'Fail' method to RunnableComponent which allows component to move from
 cin parents: 
152diff
changeset | 15 /// <summary> | 
| 250 | 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: 
152diff
changeset | 17 /// </summary> | 
| 250 | 18 void Stop(CancellationToken ct); | 
| 19 | |
| 20 Task<ExecutionState> Completion { get; } | |
| 152 | 21 | 
| 22 ExecutionState State { get; } | |
| 23 | |
| 205 
8200ab154c8a
Added ResetState to RunnableComponent to reset in case of failure
 cin parents: 
203diff
changeset | 24 event EventHandler<StateChangeEventArgs> StateChanged; | 
| 
8200ab154c8a
Added ResetState to RunnableComponent to reset in case of failure
 cin parents: 
203diff
changeset | 25 | 
| 152 | 26 Exception LastError { get; } | 
| 27 } | |
| 28 } | |
| 29 | 
