public ThreadWrapper(string name, PingPong ppObject) { thread = new Thread(new ThreadStart(this.run)); pp = ppObject; thread.Name = name; thread.Start(); }
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."); }