2007-03-28 Chris Toshok <toshok@ximian.com>
[mono-project.git] / mono / tests / main-returns-background-abort-resetabort.cs
blobf2bbba20857f5f5eea0a9a9ce8ac74900c96e263
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.IsBackground=true;
9 thr.Start();
10 Thread.Sleep(600);
11 Console.WriteLine("Aborting child thread");
12 thr.Abort();
13 Thread.Sleep(600);
14 Console.WriteLine("Main thread returns");
17 public static void thread() {
18 try {
19 Console.WriteLine("Thread running");
20 Thread.Sleep(500);
21 } catch(ThreadAbortException) {
22 Thread.ResetAbort();
23 Console.WriteLine("Abort reset!");
24 } finally {
25 Console.WriteLine("ThreadAbortException finally");
27 try {
28 Console.WriteLine("Thread running");
29 Thread.Sleep(500);
30 } catch(ThreadAbortException) {
31 Thread.ResetAbort();
32 Console.WriteLine("Abort reset!");
33 } finally {
34 Console.WriteLine("ThreadAbortException finally");
36 try {
37 Console.WriteLine("Thread running");
38 Thread.Sleep(500);
39 } catch(ThreadAbortException) {
40 Thread.ResetAbort();
41 Console.WriteLine("Abort reset!");
42 } finally {
43 Console.WriteLine("ThreadAbortException finally");
45 try {
46 Console.WriteLine("Thread running");
47 Thread.Sleep(500);
48 } catch(ThreadAbortException) {
49 Thread.ResetAbort();
50 Console.WriteLine("Abort reset!");
51 } finally {
52 Console.WriteLine("ThreadAbortException finally");
54 try {
55 Console.WriteLine("Thread running");
56 } catch(ThreadAbortException) {
57 Thread.ResetAbort();
58 Console.WriteLine("Abort reset!");
59 } finally {
60 Console.WriteLine("ThreadAbortException finally");