public virtual void Dispose() { ObjectPool.Dispose(); if (HasQueue) { TaskConsumer.Interrupt(); } }
public void StartConsumerThreads(int n) { lock (lockObj) { Assert(stopped); Assert(consumers.Count == 0); stopped = false; for (int i = 0; i < n; i++) { var consumer = new TaskConsumer(this, i); consumers.Add(consumer); consumer.Start(); } } }
//private TaskConsumer m_pFieldMan; //private TaskConsumer m_pEventMan; //private TaskConsumer m_pSecurityMan; //private TaskConsumer m_pFlushPacketMan; //----------------------------------------------------------------------------- public ServerAppThread(int dwFPS) { m_pExecutor = new TickExecutor("ServerAppThread", dwFPS); m_pExecutor.OnUpdate += OnUpdate; m_pExecutor.OnOverload += OnOverload; m_pExecutor.OnException += OnException; m_pScheduler = new TaskScheduler(); m_pGeneralConsumer = new TaskConsumer(); m_pGeneralConsumer.OnException += OnException; m_pConnectConsumer = new TaskConsumer(); m_pConnectConsumer.OnException += OnException; m_pReceiveConsumer = new TaskConsumer(); m_pReceiveConsumer.OnException += OnException; m_pDisconnectConsumer = new TaskConsumer(); m_pReceiveConsumer.OnException += OnException; }