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(); } }
public MyServerThread(int tickSleepTime, int actionNumPerTick, ServerAsyncActionProcessor asyncActionQueue) { m_TickSleepTime = tickSleepTime; m_ActionNumPerTick = actionNumPerTick; InitThread(asyncActionQueue); }
private void InitThread(ServerAsyncActionProcessor asyncActionQueue) { m_Thread = new Thread(this.Loop); m_ActionQueue = asyncActionQueue; }
public MyServerThread(int tickSleepTime, ServerAsyncActionProcessor asyncActionQueue) { m_TickSleepTime = tickSleepTime; InitThread(asyncActionQueue); }
public MyServerThread(ServerAsyncActionProcessor asyncActionQueue) { InitThread(asyncActionQueue); }