public void ClearPool(int clearOnSize) { if (m_IsPassive) { m_ActionQueue.ClearPool(clearOnSize); } else { for (int i = 0; i < m_ThreadNum; ++i) { MyServerThread thread = m_Threads[i]; thread.ClearPool(clearOnSize); } } }
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(); } }