[LoongArch64] Part-5:add loongarch support in some files for LoongArch64. (#21769)
[mono-project.git] / mono / tests / abort-cctor-2.cs
blobf1e75481489c8ddb66e7ec558592ea2df5291bd5
1 using System;
2 using System.Threading;
4 public class Critical {
5 static Critical ()
7 Program.mre1.Set ();
8 Program.mre2.WaitOne ();
9 try {
10 throw new Exception ();
11 } catch (Exception) {
12 Console.WriteLine ("Catched exception in cctor");
13 Program.catched_exception = true;
19 public class Program {
20 public static ManualResetEvent mre1 = new ManualResetEvent (false);
21 public static ManualResetEvent mre2 = new ManualResetEvent (false);
23 public static bool catched_exception, catched_abort;
25 public static int Main (string[] args)
27 Thread thread = new Thread (DoStuff);
28 thread.Start ();
30 mre1.WaitOne ();
31 thread.Abort ();
32 mre2.Set ();
34 thread.Join ();
36 if (!catched_exception)
37 Environment.Exit (1);
38 if (!catched_abort)
39 Environment.Exit (2);
41 Console.WriteLine ("done, all things good");
42 return 0;
45 public static void DoStuff ()
47 try {
48 new Critical ();
49 } catch (ThreadAbortException) {
50 Console.WriteLine ("Catched thread abort");
51 Program.catched_abort = true;