Mercurial > pub > ImplabNet
comparison Implab/Components/IRunnable.cs @ 208:7d07503621fe v2
RunnableComponent.Dispose(bool,Exception) changed to standart Dispose(bool)
IRunnable is now disposable
Code cleanups, suppressed some CodeAnalysis warnings
author | cin |
---|---|
date | Sun, 13 Nov 2016 18:28:17 +0300 |
parents | 8200ab154c8a |
children | 9f63dade3a40 |
comparison
equal
deleted
inserted
replaced
207:558f34b2fb50 | 208:7d07503621fe |
---|---|
1 using System; | 1 using System; |
2 | 2 |
3 namespace Implab.Components { | 3 namespace Implab.Components { |
4 public interface IRunnable { | 4 /// <summary> |
5 /// Interface for the component which performs a long running task. | |
6 /// </summary> | |
7 /// <remarks> | |
8 /// <para>The component also should implement <see cref="IDisposable"/> interface to be able to release used resources.</para> | |
9 /// <para>All methods of this interface must be a thread safe. If the operation is not applicable in the current state the | |
10 /// method should throw an exception and keep the current state unchanged.</para> | |
11 /// </remarks> | |
12 public interface IRunnable : IDisposable { | |
5 /// <summary> | 13 /// <summary> |
6 /// Starts this instance. | 14 /// Starts this instance |
7 /// </summary> | 15 /// </summary> |
8 IPromise Start(); | 16 IPromise Start(); |
9 | 17 |
10 /// <summary> | 18 /// <summary> |
11 /// Stops this instance. After the instance is stopped it can't be started again, stopping should be treated as gracefull and async dispose. | 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. |
12 /// </summary> | 20 /// </summary> |
13 IPromise Stop(); | 21 IPromise Stop(); |
14 | 22 |
15 ExecutionState State { get; } | 23 ExecutionState State { get; } |
16 | 24 |