[2019-12] [threads] Add back mono_threads_attach_tools_thread as a public API (#18074)
[mono-project.git] / mono / tests / block_guard_restore_aligment_on_exit.cs
blob270b1dd39b6b788702d811723353ae8532f35d41
1 using System;
2 using System.Threading;
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;
20 res = 7;
21 throw new Exception ("lalala");
24 static void Func () {
25 try {
26 InnerFunc ();
27 } catch (Exception e) {
28 res = 0;
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;