Ejemplo n.º 1
0
 public void run(int threads = 1, ThreadPriority priority = ThreadPriority.Normal, bool background = false, string name = null)
 {
     lock (this)
     {
         Trace.Assert(null == _runThreads, "work_engine 已经运行!");
         _service.reset();
         _service.hold_work();
         _runThreads = new Thread[threads];
         for (int i = 0; i < threads; ++i)
         {
             _runThreads[i]              = new Thread(() => _service.run());
             _runThreads[i].Priority     = priority;
             _runThreads[i].IsBackground = background;
             _runThreads[i].Name         = null == name ? "任务调度" : string.Format("{0}<{1}>", name, i);
             _runThreads[i].Start();
         }
     }
 }
Ejemplo n.º 2
0
 void run_thread()
 {
     _service.run();
 }