2 using System.Threading;
8 public static int Main ()
10 return TestDriver.RunTests (typeof (Tests));
13 public static void TestMethod()
15 Console.WriteLine("{0} with {1} priority",
16 Thread.CurrentThread.Name,
17 Thread.CurrentThread.Priority.ToString());
19 Console.WriteLine("{0} with {1} priority",
20 Thread.CurrentThread.Name,
21 Thread.CurrentThread.Priority.ToString());
24 public static int test_0_thread_priority ()
28 Thread Me = Thread.CurrentThread;
29 Thread TestThread = new Thread(new ThreadStart(TestMethod));
31 Console.WriteLine("Starting test thread with priority to AboveNormal");
32 ThreadPriority before = TestThread.Priority;
33 TestThread.Priority = ThreadPriority.AboveNormal;
34 TestThread.Name = "TestMethod";
36 ThreadPriority after = TestThread.Priority;
37 Console.WriteLine("Priority: {0} {1}",before,after);
38 if (before != ThreadPriority.Normal)
40 else if (after != ThreadPriority.AboveNormal)
43 TestThread.Priority = ThreadPriority.Normal;
44 after = TestThread.Priority;
45 Console.WriteLine("Setting test thread priority to Normal");
47 Console.WriteLine("Priority: {0} {1}",before,after);
49 if (after != ThreadPriority.Normal)
52 Console.WriteLine("Setting test thread priority to AboveNormal");
54 TestThread.Priority=ThreadPriority.AboveNormal;
55 after = TestThread.Priority;
57 Console.WriteLine("Priority: {0} {1}",before,after);
59 if (after != ThreadPriority.AboveNormal)
63 Console.WriteLine("Setting test thread priority to BelowNormal");
64 TestThread.Priority=ThreadPriority.BelowNormal;
65 after = TestThread.Priority;
66 Console.WriteLine("Priority: {0} {1}",before,after);
69 if (after != ThreadPriority.BelowNormal)
73 Console.WriteLine("Setting test thread priority back to Normal");
74 TestThread.Priority=ThreadPriority.Normal;
75 after = TestThread.Priority;
76 Console.WriteLine("Priority: {0} {1}",before,after);
79 if (after != ThreadPriority.Normal)