annotate Implab/Components/IAsyncComponent.cs @ 259:7d52dc684bbd v3

PollingComponent: implemented correct stopping
author cin
date Fri, 13 Apr 2018 03:57:39 +0300
parents c52691faaf21
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
256
c52691faaf21 Removed obsolete App, ComponentContainer
cin
parents:
diff changeset
1 using System;
c52691faaf21 Removed obsolete App, ComponentContainer
cin
parents:
diff changeset
2 using System.Threading.Tasks;
c52691faaf21 Removed obsolete App, ComponentContainer
cin
parents:
diff changeset
3
c52691faaf21 Removed obsolete App, ComponentContainer
cin
parents:
diff changeset
4 namespace Implab.Components {
c52691faaf21 Removed obsolete App, ComponentContainer
cin
parents:
diff changeset
5 /// <summary>
c52691faaf21 Removed obsolete App, ComponentContainer
cin
parents:
diff changeset
6 /// An interface for asynchronous components.
c52691faaf21 Removed obsolete App, ComponentContainer
cin
parents:
diff changeset
7 /// </summary>
c52691faaf21 Removed obsolete App, ComponentContainer
cin
parents:
diff changeset
8 /// <remarks>
c52691faaf21 Removed obsolete App, ComponentContainer
cin
parents:
diff changeset
9 /// <para>
c52691faaf21 Removed obsolete App, ComponentContainer
cin
parents:
diff changeset
10 /// Асинхронные компоненты не предназначены для одновременного использования несколькими клиентами,
c52691faaf21 Removed obsolete App, ComponentContainer
cin
parents:
diff changeset
11 /// однако существуют внутренние процессы, изменяющее состояние компонент без участия клиента.
c52691faaf21 Removed obsolete App, ComponentContainer
cin
parents:
diff changeset
12 /// Данный интерфейс определяет протокол взаимодействия с компонентой, при которм компоненте
c52691faaf21 Removed obsolete App, ComponentContainer
cin
parents:
diff changeset
13 /// посылаются сигналы от клиента, в ответ на которые компонента меняет свойство <see cref="Completion"/>,
c52691faaf21 Removed obsolete App, ComponentContainer
cin
parents:
diff changeset
14 /// данное свойство содержит в себе новую задачу, выполняемую компонентой и данное свойство
c52691faaf21 Removed obsolete App, ComponentContainer
cin
parents:
diff changeset
15 /// может измениться только при получении нового сигнала от клиента.
c52691faaf21 Removed obsolete App, ComponentContainer
cin
parents:
diff changeset
16 /// </para>
c52691faaf21 Removed obsolete App, ComponentContainer
cin
parents:
diff changeset
17 /// <para>
c52691faaf21 Removed obsolete App, ComponentContainer
cin
parents:
diff changeset
18 /// В дополнение к <see cref="Completion"/> компонента может определять другие свойства, в
c52691faaf21 Removed obsolete App, ComponentContainer
cin
parents:
diff changeset
19 /// которых будет передаваться информация о результате выполнения операции.
c52691faaf21 Removed obsolete App, ComponentContainer
cin
parents:
diff changeset
20 /// </para>
c52691faaf21 Removed obsolete App, ComponentContainer
cin
parents:
diff changeset
21 /// <para>
c52691faaf21 Removed obsolete App, ComponentContainer
cin
parents:
diff changeset
22 /// Особое внимание следует уделить реализации <see cref="IDisposable"/>, который по своей природе
c52691faaf21 Removed obsolete App, ComponentContainer
cin
parents:
diff changeset
23 /// синхронный, данное правило безусловно можно нарушить, но тогда могут возникнуть проблемы с
c52691faaf21 Removed obsolete App, ComponentContainer
cin
parents:
diff changeset
24 /// тем, что ресурсы еще не освободились, а ход программы продолжается, что приведет к ошибкам,
c52691faaf21 Removed obsolete App, ComponentContainer
cin
parents:
diff changeset
25 /// например при попытке получить ресуср другим объектом, либо при заврешении программы.
c52691faaf21 Removed obsolete App, ComponentContainer
cin
parents:
diff changeset
26 /// </para>
c52691faaf21 Removed obsolete App, ComponentContainer
cin
parents:
diff changeset
27 /// <seealso href="https://blog.stephencleary.com/2013/01/async-oop-0-introduction.html"/>
c52691faaf21 Removed obsolete App, ComponentContainer
cin
parents:
diff changeset
28 /// </remarks>
c52691faaf21 Removed obsolete App, ComponentContainer
cin
parents:
diff changeset
29 public interface IAsyncComponent {
c52691faaf21 Removed obsolete App, ComponentContainer
cin
parents:
diff changeset
30 /// <summary>
c52691faaf21 Removed obsolete App, ComponentContainer
cin
parents:
diff changeset
31 /// The result of the last started operation. This property reflects
c52691faaf21 Removed obsolete App, ComponentContainer
cin
parents:
diff changeset
32 /// only the result of the last started operation and therefore should
c52691faaf21 Removed obsolete App, ComponentContainer
cin
parents:
diff changeset
33 /// change only if a new operation is initiated.
c52691faaf21 Removed obsolete App, ComponentContainer
cin
parents:
diff changeset
34 /// </summary>
c52691faaf21 Removed obsolete App, ComponentContainer
cin
parents:
diff changeset
35 Task Completion { get; }
c52691faaf21 Removed obsolete App, ComponentContainer
cin
parents:
diff changeset
36 }
c52691faaf21 Removed obsolete App, ComponentContainer
cin
parents:
diff changeset
37 }