1 // Compiler options: -langversion:future
4 using System.Threading;
5 using System.Threading.Tasks;
11 var mre = new ManualResetEvent (false);
12 var mre_l = new ManualResetEvent (false);
14 Action a = async () => {
15 await Task.Factory.StartNew (() => {
16 if (!mre_l.WaitOne (3000))
17 throw new ApplicationException ("1");
26 if (!mre.WaitOne (3000))
32 Action a2 = async delegate {
33 await Task.Factory.StartNew (() => {
34 if (!mre_l.WaitOne (3000))
35 throw new ApplicationException ("2");
44 if (!mre.WaitOne (3000))
49 Func<string, Task<string>> f = async l => {
50 var t = await Task.Factory.StartNew (() => {
51 if (!mre_l.WaitOne (3000))
52 throw new ApplicationException ("3");
70 Func<decimal, Task<decimal>> f2 = async delegate (decimal l) {
71 var t = await Task.Factory.StartNew (() => {
72 if (!mre_l.WaitOne (3000))
73 throw new ApplicationException ("4");
81 var r2 = f2 (decimal.MaxValue);
86 if (r2.Result != decimal.MaxValue)
89 f2 = async delegate (decimal l) {