Esempio n. 1
0
 protected override void run_task()
 {
     _service.hold_work();
     _service.push_option(delegate()
     {
         run_a_round();
         _service.release_work();
     });
 }
Esempio n. 2
0
 public void run(int threads = 1)
 {
     _service.reset();
     _service.hold_work();
     _runThreads = new Thread[threads];
     for (int i = 0; i < threads; ++i)
     {
         _runThreads[i] = new Thread(run_thread);
         _runThreads[i].Start();
     }
 }
Esempio n. 3
0
 public void run(int threads = 1, ThreadPriority priority = ThreadPriority.Normal, bool IsBackground = false)
 {
     _service.reset();
     _service.hold_work();
     _runThreads = new Thread[threads];
     for (int i = 0; i < threads; ++i)
     {
         _runThreads[i]              = new Thread(run_thread);
         _runThreads[i].Priority     = priority;
         _runThreads[i].IsBackground = IsBackground;
         _runThreads[i].Name         = "任务调度";
         _runThreads[i].Start();
     }
 }
Esempio n. 4
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();
         }
     }
 }
Esempio n. 5
0
 protected override void next_a_round()
 {
     _service.hold_work();
     _service.post(_runTask);
 }
Esempio n. 6
0
 internal work_guard(work_service service)
 {
     _service = service;
     _service.hold_work();
 }
Esempio n. 7
0
 protected override void run_task()
 {
     _service.hold_work();
     _service.push_option(_runTask);
 }