Exemple #1
0
        public void Run()
        {
            //new Thread(() =>
            //{
            //    Random rnd = new Random();
            //    do
            //    {
            //        LoggerMgr.GetInstance().Notify(new Logger(EnumLoggerType.Normal, rnd.Next(10, 99).ToString()));
            //        Thread.Sleep(500);
            //    }
            //    while (true);
            //}).Start();
            //ITaskMgr taskMgr = TaskMgr.GetInstance();
            //taskMgr.Start();
            ////taskMgr.AddWork(Work, OnWorkCompltedCallBack);
            int i = 0;
            int j = 500;

            new Thread(() =>
            {
                ITaskMgr taskMgr = TaskMgr.GetInstance();
                taskMgr.Start();
                while (i < j)
                {
                    taskMgr.AddWork(Work, OnWorkCompltedCallBack);
                    Thread.Sleep(10);
                    i++;
                }
                taskMgr.Stop();
            }).Start();
        }
Exemple #2
0
 public static ITaskMgr GetInstance()
 {
     lock (lck4Instance)
     {
         if (null == _Instance)
         {
             _Instance = new TaskMgr();
             _Instance.Initlize();
         }
         return(_Instance);
     }
 }
Exemple #3
0
 public static ITaskMgr GetInstance()
 {
     lock (lck4Instance)
     {
         if (null == _Instance)
         {
             _Instance = new TaskMgr();
             _Instance.Initlize();
         }
         return _Instance;
     }
 }