Mercurial > pub > ImplabNet
annotate Implab/Components/IRunnable.cs @ 243:b1e0ffdf3451 v3
working on promises
author | cin |
---|---|
date | Wed, 24 Jan 2018 19:24:10 +0300 |
parents | 7d07503621fe |
children | 9f63dade3a40 |
rev | line source |
---|---|
152 | 1 using System; |
2 | |
3 namespace Implab.Components { | |
208
7d07503621fe
RunnableComponent.Dispose(bool,Exception) changed to standart Dispose(bool)
cin
parents:
205
diff
changeset
|
4 /// <summary> |
7d07503621fe
RunnableComponent.Dispose(bool,Exception) changed to standart Dispose(bool)
cin
parents:
205
diff
changeset
|
5 /// Interface for the component which performs a long running task. |
7d07503621fe
RunnableComponent.Dispose(bool,Exception) changed to standart Dispose(bool)
cin
parents:
205
diff
changeset
|
6 /// </summary> |
7d07503621fe
RunnableComponent.Dispose(bool,Exception) changed to standart Dispose(bool)
cin
parents:
205
diff
changeset
|
7 /// <remarks> |
7d07503621fe
RunnableComponent.Dispose(bool,Exception) changed to standart Dispose(bool)
cin
parents:
205
diff
changeset
|
8 /// <para>The component also should implement <see cref="IDisposable"/> interface to be able to release used resources.</para> |
7d07503621fe
RunnableComponent.Dispose(bool,Exception) changed to standart Dispose(bool)
cin
parents:
205
diff
changeset
|
9 /// <para>All methods of this interface must be a thread safe. If the operation is not applicable in the current state the |
7d07503621fe
RunnableComponent.Dispose(bool,Exception) changed to standart Dispose(bool)
cin
parents:
205
diff
changeset
|
10 /// method should throw an exception and keep the current state unchanged.</para> |
7d07503621fe
RunnableComponent.Dispose(bool,Exception) changed to standart Dispose(bool)
cin
parents:
205
diff
changeset
|
11 /// </remarks> |
7d07503621fe
RunnableComponent.Dispose(bool,Exception) changed to standart Dispose(bool)
cin
parents:
205
diff
changeset
|
12 public interface IRunnable : IDisposable { |
203
4d9830a9bbb8
Added 'Fail' method to RunnableComponent which allows component to move from
cin
parents:
152
diff
changeset
|
13 /// <summary> |
208
7d07503621fe
RunnableComponent.Dispose(bool,Exception) changed to standart Dispose(bool)
cin
parents:
205
diff
changeset
|
14 /// Starts this instance |
203
4d9830a9bbb8
Added 'Fail' method to RunnableComponent which allows component to move from
cin
parents:
152
diff
changeset
|
15 /// </summary> |
152 | 16 IPromise Start(); |
17 | |
203
4d9830a9bbb8
Added 'Fail' method to RunnableComponent which allows component to move from
cin
parents:
152
diff
changeset
|
18 /// <summary> |
208
7d07503621fe
RunnableComponent.Dispose(bool,Exception) changed to standart Dispose(bool)
cin
parents:
205
diff
changeset
|
19 /// Stops this instance, after the instance is stopped it can move to Failed, Ready or Disposed state, in case with the last it can't be reused. |
203
4d9830a9bbb8
Added 'Fail' method to RunnableComponent which allows component to move from
cin
parents:
152
diff
changeset
|
20 /// </summary> |
152 | 21 IPromise Stop(); |
22 | |
23 ExecutionState State { get; } | |
24 | |
205
8200ab154c8a
Added ResetState to RunnableComponent to reset in case of failure
cin
parents:
203
diff
changeset
|
25 event EventHandler<StateChangeEventArgs> StateChanged; |
8200ab154c8a
Added ResetState to RunnableComponent to reset in case of failure
cin
parents:
203
diff
changeset
|
26 |
152 | 27 Exception LastError { get; } |
28 } | |
29 } | |
30 |