示例#1
0
 public ThreadWrapper(string name, PingPong ppObject)
 {
     thread      = new Thread(new ThreadStart(this.run));
     pp          = ppObject;
     thread.Name = name;
     thread.Start();
 }
示例#2
0
        public static void Execute()
        {
            PingPong pp = new PingPong();

            Console.WriteLine("The Ball is dropped... \n");
            ThreadWrapper mythread1 = new ThreadWrapper("Ping", pp);
            ThreadWrapper mythread2 = new ThreadWrapper("Pong", pp);

            mythread1.thread.Join();
            mythread2.thread.Join();
            Console.WriteLine("\nThe Ball Stops Bouncing.");
        }