diff 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
line wrap: on
line diff
--- a/Implab/Components/IRunnable.cs	Wed Jan 31 11:28:38 2018 +0300
+++ b/Implab/Components/IRunnable.cs	Thu Feb 01 02:43:35 2018 +0300
@@ -1,24 +1,23 @@
 using System;
+using System.Threading;
+using System.Threading.Tasks;
 
 namespace Implab.Components {
-    /// <summary>
-    /// Interface for the component which performs a long running task.
+    /// <summary>
+    /// Interface for the component which performs a long running task.
     /// </summary>
-    /// <remarks>
-    /// <para>The component also should implement <see cref="IDisposable"/> interface to be able to release used resources.</para>
-    /// <para>All methods of this interface must be a thread safe. If the operation is not applicable in the current state the
-    /// method should throw an exception and keep the current state unchanged.</para>
-    /// </remarks>
     public interface IRunnable : IDisposable {
         /// <summary>
         /// Starts this instance
         /// </summary>
-        IPromise Start();
+        void Start(CancellationToken ct);
 
         /// <summary>
-        /// 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.
+        /// Stops this instance and releases all resources, after the instance is stopped it is moved to Disposed state and can't be reused.
         /// </summary>
-        IPromise Stop();
+        void Stop(CancellationToken ct);
+
+        Task<ExecutionState> Completion { get; }
 
         ExecutionState State { get; }