Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / mono / tests / block_guard_restore_aligment_on_exit.cs
1 using System;
2 using System.Threading;
3
4 class Driver {
5         static volatile bool foo = false;
6         static int res = 1;
7         static void InnerFunc () {
8                 res = 2;
9                 try {
10                         res = 3;
11                 } finally {
12                         res = 4;
13                         Console.WriteLine ("EEE");
14                         while (!foo); 
15                         res = 5;
16                         Console.WriteLine ("in the finally block");
17                         Thread.ResetAbort ();
18                         res = 6;
19                 }
20                 res = 7;
21                 throw new Exception ("lalala");
22         }
23
24         static void Func () {
25                 try {
26                         InnerFunc ();
27                 } catch (Exception e) {
28                         res = 0;
29                 }
30         }
31         
32         static int Main () {
33                 Thread t = new Thread (Func);
34                 t.Start ();
35                 Thread.Sleep (100);
36                 t.Abort ();
37                 foo = true;
38                 Console.WriteLine ("What now?");
39                 t.Join ();
40                 Thread.Sleep (500);
41                 return res;
42         }
43 }