Mercurial > pub > ImplabNet
annotate Implab/Components/IRunnable.cs @ 274:22629bf26121 v3
Unity xml configuration, alpha2
author | cin |
---|---|
date | Fri, 27 Apr 2018 04:47:52 +0300 |
parents | f1696cdc3d7a |
children |
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:
205
diff
changeset
|
8 /// </summary> |
251 | 9 /// <remarks> |
10 /// The access to the runnable component should be sequential, the | |
11 /// componet should support asynchronous completion of the initiated | |
12 /// operation but operations itself must be initiated sequentially. | |
13 /// </remarks> | |
14 public interface IRunnable { | |
203
4d9830a9bbb8
Added 'Fail' method to RunnableComponent which allows component to move from
cin
parents:
152
diff
changeset
|
15 /// <summary> |
208
7d07503621fe
RunnableComponent.Dispose(bool,Exception) changed to standart Dispose(bool)
cin
parents:
205
diff
changeset
|
16 /// Starts this instance |
203
4d9830a9bbb8
Added 'Fail' method to RunnableComponent which allows component to move from
cin
parents:
152
diff
changeset
|
17 /// </summary> |
251 | 18 /// <remarks> |
19 /// This operation is cancellable and it's expected to move to | |
20 /// the failed state or just ignore the cancellation request, | |
21 /// </remarks> | |
262 | 22 void Start(); |
250 | 23 void Start(CancellationToken ct); |
152 | 24 |
203
4d9830a9bbb8
Added 'Fail' method to RunnableComponent which allows component to move from
cin
parents:
152
diff
changeset
|
25 /// <summary> |
251 | 26 /// Stops this instance and releases all resources, after the |
27 /// instance is stopped it is moved to Disposed state and | |
28 /// can't be reused. | |
203
4d9830a9bbb8
Added 'Fail' method to RunnableComponent which allows component to move from
cin
parents:
152
diff
changeset
|
29 /// </summary> |
251 | 30 /// <remarks> |
31 /// If the componet was in the starting state the pending operation | |
32 /// will be requested to cancel. The stop operatin will be | |
33 /// performed only if the component in the running state. | |
34 /// </remarks> | |
262 | 35 void Stop(); |
250 | 36 void Stop(CancellationToken ct); |
262 | 37 |
251 | 38 /// <summary> |
256 | 39 /// Current state of the componenet, dynamically reflects the current state. |
251 | 40 /// </summary> |
152 | 41 ExecutionState State { get; } |
42 | |
251 | 43 /// <summary> |
44 /// Event to monitor the state of the component. | |
45 /// </summary> | |
205
8200ab154c8a
Added ResetState to RunnableComponent to reset in case of failure
cin
parents:
203
diff
changeset
|
46 event EventHandler<StateChangeEventArgs> StateChanged; |
8200ab154c8a
Added ResetState to RunnableComponent to reset in case of failure
cin
parents:
203
diff
changeset
|
47 |
251 | 48 /// <summary> |
49 /// The last error | |
50 /// </summary> | |
152 | 51 Exception LastError { get; } |
52 } | |
53 } | |
54 |