예제 #1
0
 private void InitTaskThreads(int threadNum, bool isPassive)
 {
     if (isPassive)
     {
         m_ActionQueue = new ServerAsyncActionProcessor();
     }
     m_Threads = new MyServerThread[threadNum];
     for (int i = 0; i < threadNum; ++i)
     {
         MyServerThread thread = null;
         if (isPassive)
         {
             thread = new MyServerThread(m_ActionQueue);//线程主动取策略
         }
         else
         {
             thread = new MyServerThread();//dispatcher主动推策略
         }
         m_Threads[i] = thread;
         thread.Start();
     }
 }
예제 #2
0
 public MyServerThread(int tickSleepTime, int actionNumPerTick, ServerAsyncActionProcessor asyncActionQueue)
 {
     m_TickSleepTime    = tickSleepTime;
     m_ActionNumPerTick = actionNumPerTick;
     InitThread(asyncActionQueue);
 }
예제 #3
0
 private void InitThread(ServerAsyncActionProcessor asyncActionQueue)
 {
     m_Thread      = new Thread(this.Loop);
     m_ActionQueue = asyncActionQueue;
 }
예제 #4
0
 public MyServerThread(int tickSleepTime, ServerAsyncActionProcessor asyncActionQueue)
 {
     m_TickSleepTime = tickSleepTime;
     InitThread(asyncActionQueue);
 }
예제 #5
0
 public MyServerThread(ServerAsyncActionProcessor asyncActionQueue)
 {
     InitThread(asyncActionQueue);
 }