日期:2018-03-26  浏览次数:3131 次

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            test a = new test(0, 5);
            
        }
    }

    public class test
    {
        private System.Threading.Thread th;

        public  test(int stopm,int stops)
        {
            System.Threading.ParameterizedThreadStart pts = new System.Threading.ParameterizedThreadStart(t);
            th = new System.Threading.Thread(pts);
            th.Start(new List<int>() { 0,2});
        }

        private void t(object parm)
        {
            int sm, ss;
            sm = ss = 0;

            List<int> p = parm as List<int>;
            while (true)
            {
                ss++;
                if (ss == 60)
                {
                    sm++;
                }
                if (sm ==p[0] && ss == p[1])
                {
                    break;
                }
                System.Threading.Thread.Sleep(1000);
            }
            Console.WriteLine("Done");

        }
    }
}