コード例 #1
0
        public void WorkerTask(int limit)
        {
            ThreadingTest3 th = new ThreadingTest3();
            var            t1 = Task.Run(() => th.PrintNumbersBy2(0, limit));
            var            t2 = Task.Run(() => th.PrintNumbersBy2(1, limit));

            t2.Wait();
            t1.Wait();
        }
コード例 #2
0
        public void WorkerThread(int limit)
        {
            ThreadingTest3 th       = new ThreadingTest3();
            var            cworker1 = new Thread(() => th.PrintNumbersBy2(0, limit));
            var            cworker2 = new Thread(() => th.PrintNumbersBy2(1, limit));

            cworker1.Start();
            cworker2.Start();
            cworker1.Join();
            cworker2.Join();
            //th.PrintNumbersBy2(3,100);
        }