using System; using System.Threading; using System.Threading.Tasks; namespace Implab.Components { /// /// Interface for the component which performs a long running task. /// public interface IRunnable : IDisposable { /// /// Starts this instance /// void Start(CancellationToken ct); /// /// Stops this instance and releases all resources, after the instance is stopped it is moved to Disposed state and can't be reused. /// void Stop(CancellationToken ct); Task Completion { get; } ExecutionState State { get; } event EventHandler StateChanged; Exception LastError { get; } } }