Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / mono / tests / main-returns-background-resetabort.cs
1
2 using System;
3 using System.Threading;
4
5 public class foo {
6         public static void Main() {
7                 Thread thr=new Thread(new ThreadStart(foo.thread));
8                 thr.IsBackground=true;
9                 thr.Start();
10                 Thread.Sleep(1200);
11                 Console.WriteLine("Main thread returns");
12         }
13
14         public static void thread() {
15                 try {
16                         Console.WriteLine("Thread running");
17                         Thread.Sleep(500);
18                 } catch(ThreadAbortException) {
19                         Thread.ResetAbort();
20                         Console.WriteLine("Abort reset!");
21                 } finally {
22                         Console.WriteLine("ThreadAbortException finally");
23                 }
24                 try {
25                         Console.WriteLine("Thread running");
26                         Thread.Sleep(500);
27                 } catch(ThreadAbortException) {
28                         Thread.ResetAbort();
29                         Console.WriteLine("Abort reset!");
30                 } finally {
31                         Console.WriteLine("ThreadAbortException finally");
32                 }
33                 try {
34                         Console.WriteLine("Thread running");
35                         Thread.Sleep(500);
36                 } catch(ThreadAbortException) {
37                         Thread.ResetAbort();
38                         Console.WriteLine("Abort reset!");
39                 } finally {
40                         Console.WriteLine("ThreadAbortException finally");
41                 }
42                 try {
43                         Console.WriteLine("Thread running");
44                         Thread.Sleep(500);
45                 } catch(ThreadAbortException) {
46                         Thread.ResetAbort();
47                         Console.WriteLine("Abort reset!");
48                 } finally {
49                         Console.WriteLine("ThreadAbortException finally");
50                 }
51                 try {
52                         Console.WriteLine("Thread running");
53                 } catch(ThreadAbortException) {
54                         Thread.ResetAbort();
55                         Console.WriteLine("Abort reset!");
56                 } finally {
57                         Console.WriteLine("ThreadAbortException finally");
58                 }
59         }
60 }
61