1 // Compiler options: -langversion:future
4 using System.Threading;
5 using System.Threading.Tasks;
9 public static int Main ()
11 var mre_l = new ManualResetEvent (false);
12 var mre = new ManualResetEvent (false);
14 Func<string, Task<string>> f = async l =>
15 await Task.Factory.StartNew (() => {
16 if (!mre_l.WaitOne (3000))
17 throw new ApplicationException ("3");
32 Func<Task> ff = async () =>
33 await Task.Factory.StartNew (() => {
34 if (!mre_l.WaitOne (3000))
35 throw new ApplicationException ("3");
43 Func<short, Task<short>> f2 = async l => l;
51 Action a = async () => await Task.Factory.StartNew (() => {
52 if (!mre_l.WaitOne (3000))
53 throw new ApplicationException ("4");
55 }, CancellationToken.None);
59 if (!mre.WaitOne (3000))
62 Console.WriteLine ("ok");