Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            HelloWriter x = new HelloWriter();

            Thread a = new Thread(() => x.sayHello("james"));

            a.Start();

            Thread b = new Thread(() => x.sayHello("other james"));

            b.Start();
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            HelloWriter x = new HelloWriter();
            HelloWriter y = new HelloWriter();


            Thread a = new Thread(() => x.sayHello("james", 5));

            x.sleepPeriod = 200;
            a.Start();

            Thread b = new Thread(() => y.sayHello("other james", 10));

            y.sleepPeriod = 500;
            b.Start();

            NeverEnding c = new NeverEnding();
            Thread      d = new Thread(() => c.neverEndindStory());

            d.Start();

            a.Join();
            b.Join();


            Console.WriteLine("Hello World from main");
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            HelloWriter x = new HelloWriter();
            HelloWriter y = new HelloWriter();


            Thread a = new Thread(() => x.sayHello("james", 5));

            x.sleepPeriod = 200;
            a.Start();

            Thread b = new Thread(() => y.sayHello("other james", 10));

            y.sleepPeriod = 500;
            b.Start();
        }