IKVM11  11
Java SE 11 Virtual Machine for .NET
Loading...
Searching...
No Matches
TaskExtensions.cs
Go to the documentation of this file.
1using System;
2using System.Threading;
3using System.Threading.Tasks;
4
5#if FIRST_PASS == false
6
7using java.util.concurrent;
8
9#endif
10
12{
13
14 static class TaskExtensions
15 {
16
17#if FIRST_PASS == false
18
19 public static Future ToFuture<T>(this Task<T> task, Func<bool> cancellation)
20 {
21 return new TaskFuture<T>(task, cancellation);
22 }
23
24 public static Future ToFuture<T>(this Task<T> task, CancellationTokenSource cancellationTokenSource)
25 {
26 return new TaskFuture<T>(task, () => { cancellationTokenSource.Cancel(); return true; });
27 }
28
29 public static Future ToFuture<T>(this Task<T> task)
30 {
31 return new TaskFuture<T>(task);
32 }
33
34#endif
35
36 }
37
38}
static Future ToFuture< T >(this Task< T > task, Func< bool > cancellation)
Implements the Java Future interface around a .NET Task.
Definition TaskFuture.cs:19