2 using System.Threading;
3 using System.Threading.Tasks;
7 public static int Main ()
9 var mre = new ManualResetEvent (false);
10 var mre_l = new ManualResetEvent (false);
12 Action a = async () => {
13 await Task.Factory.StartNew (() => {
14 if (!mre_l.WaitOne (3000))
15 throw new ApplicationException ("1");
16 }).ConfigureAwait (false);
24 if (!mre.WaitOne (3000))
30 Action a2 = async delegate {
31 await Task.Factory.StartNew (() => {
32 if (!mre_l.WaitOne (3000))
33 throw new ApplicationException ("2");
34 }).ConfigureAwait (false);
42 if (!mre.WaitOne (3000))
47 Func<string, Task<string>> f = async l => {
48 var t = await Task.Factory.StartNew (() => {
49 if (!mre_l.WaitOne (3000))
50 throw new ApplicationException ("3");
53 }).ConfigureAwait (false);
68 Func<decimal, Task<decimal>> f2 = async delegate (decimal l) {
69 var t = await Task.Factory.StartNew (() => {
70 if (!mre_l.WaitOne (3000))
71 throw new ApplicationException ("4");
74 }).ConfigureAwait (false);
79 var r2 = f2 (decimal.MaxValue);
84 if (r2.Result != decimal.MaxValue)
87 f2 = async delegate (decimal l) {