forked from giacomelli/GeneticSharp
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathITaskExecutor.cs
More file actions
58 lines (51 loc) · 1.67 KB
/
ITaskExecutor.cs
File metadata and controls
58 lines (51 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
using System;
using System.Diagnostics.CodeAnalysis;
using System.Threading;
using System.Threading.Tasks;
namespace GeneticSharp
{
/// <summary>
/// Defines a interface to a task executor.
/// </summary>
public interface ITaskExecutor
{
#region Properties
/// <summary>
/// Gets or sets the timeout to execute the tasks.
/// </summary>
TimeSpan Timeout { get; set; }
/// <summary>
/// Gets a value indicating whether this instance is running.
/// </summary>
/// <value>
/// <c>true</c> if this instance is running; otherwise, <c>false</c>.
/// </value>
bool IsRunning { get; }
/// <summary>
/// Gets the cancellation token.
/// </summary>
CancellationToken CancellationToken { get; }
#endregion
#region Methods
/// <summary>
/// Add the specified task to be executed.
/// </summary>
/// <param name="task">The task.</param>
void Add(Func<CancellationToken, ValueTask> task);
/// <summary>
/// Clear all the tasks.
/// </summary>
void Clear();
/// <summary>
/// Starts the tasks execution.
/// </summary>
/// <returns>If has reach the timeout false, otherwise true.</returns>
bool Start();
/// <summary>
/// Stops the tasks execution.
/// </summary>
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Stop", Justification = "there is no better name")]
void Stop();
#endregion
}
}