[2020-02] Avoid following invalid pointers in mono_w32process_get_modules on Darwin...
[mono-project.git] / mono / tests / main-returns-abort-resetabort.cs
blobcc28b74917d785f7fde26d60d4620559ceda506b
2 using System;
3 using System.Threading;
5 public class foo {
6 public static void Main() {
7 Thread thr=new Thread(new ThreadStart(foo.thread));
8 thr.Start();
9 Thread.Sleep(600);
10 Console.WriteLine("Aborting child thread");
11 thr.Abort();
12 Console.WriteLine("Main thread returns");
15 public static void thread() {
16 try {
17 Console.WriteLine("Thread running 1");
18 Thread.Sleep(500);
19 } catch(ThreadAbortException) {
20 Thread.ResetAbort();
21 Console.WriteLine("Abort reset! 1");
22 } finally {
23 Console.WriteLine("ThreadAbortException finally 1");
25 try {
26 Console.WriteLine("Thread running 2");
27 Thread.Sleep(500);
28 } catch(ThreadAbortException) {
29 Thread.ResetAbort();
30 Console.WriteLine("Abort reset! 2");
31 } finally {
32 Console.WriteLine("ThreadAbortException finally 2");
34 try {
35 Console.WriteLine("Thread running 3");
36 Thread.Sleep(500);
37 } catch(ThreadAbortException) {
38 Thread.ResetAbort();
39 Console.WriteLine("Abort reset! 3");
40 } finally {
41 Console.WriteLine("ThreadAbortException finally 3");
43 try {
44 Console.WriteLine("Thread running 4");
45 Thread.Sleep(500);
46 } catch(ThreadAbortException) {
47 Thread.ResetAbort();
48 Console.WriteLine("Abort reset! 4");
49 } finally {
50 Console.WriteLine("ThreadAbortException finally 4");
52 try {
53 Console.WriteLine("Thread running 5");
54 } catch(ThreadAbortException) {
55 Thread.ResetAbort();
56 Console.WriteLine("Abort reset! 5");
57 } finally {
58 Console.WriteLine("ThreadAbortException finally 5");