Example #1
0
        public static void Main()
        {
            Thread t1 = new Thread(delegate(object o) { int choice = Chess.Choose(5); });
            Thread t2 = new Thread(delegate(object o) { int choice = Chess.Choose(5); });

            CalculateTest c = new CalculateTest();

            t1.Start(c);
            t2.Start(c);
            t1.Join();
            t2.Join();
        }
Example #2
0
        public static void Main()
        {
            Thread t1 = new Thread(delegate(object o) {
                Monitor.Enter(o);
                int choice = Chess.Choose(2);
                Monitor.Exit(o);
            });
            Thread t2 = new Thread(delegate(object o) {
                Monitor.Enter(o);
                int choice = Chess.Choose(1);
                Monitor.Exit(o);
            });
            CalculateTest c = new CalculateTest();

            t1.Start(c);
            t2.Start(c);
            t1.Join();
            t2.Join();
        }
Example #3
0
 public static bool Run()
 {
     CalculateTest.Main();
     return(true);
 }