3 using System.Threading;
6 static Object mon = new Object();
7 static Object reply = new Object();
8 static Object bogus = new Object();
10 private void Thread_func() {
11 Console.WriteLine("thread: In a thread!");
15 Console.WriteLine("thread: Waiting for mon");
19 Console.WriteLine("thread: Pulsed mon");
25 Console.WriteLine("thread: Got reply mutex");
27 Console.WriteLine("thread: Pulsed reply");
31 public static int Main () {
32 Console.WriteLine ("main: Hello, World!");
34 Test test = new Test();
35 Thread thr=new Thread(new ThreadStart(test.Thread_func));
39 Console.WriteLine("main: mon lock 1");
42 Console.WriteLine("main: mon lock 2");
44 Console.WriteLine("main: Waiting for mon");
46 Console.WriteLine("main: mon waited");
50 Console.WriteLine("main: reply locked");
52 Console.WriteLine("main: reply locked");
54 Console.WriteLine("main: reply locked");
56 Console.WriteLine("main: reply locked");
58 Console.WriteLine("main: reply waited");
61 Console.WriteLine("Seeing how many locks we have...");
63 Console.WriteLine("main: Exit reply");
65 Console.WriteLine("main: Exit reply");
67 Console.WriteLine("main: Exit reply");
69 Console.WriteLine("main: Exit reply");
71 Console.WriteLine("main: Exit reply");
73 Console.WriteLine("main: Exit reply");
75 Console.WriteLine("main: Exit reply");
78 Console.WriteLine("main: Exit bogus");