Beispiel #1
0
    //添加大小为size的字节数组pData
    public void Push(byte[] pData, int size)
    {
        if (pData == null || size == 0)
        {
            return;
        }

        stMsg msg = new stMsg();

        msg.buffer = new byte[size];
        msg.size   = size;
        Array.Copy(pData, 0, msg.buffer, 0, size);       //新加入的消息设置数据

        lock (m_queue)
        {
            m_queue.Add(msg);
        }
    }
Beispiel #2
0
        private void TriggerEvent()
        {
            CEventMgr eventMgr = CEventMgr.Instance;

            if (eventMgr == null)
            {
                return;
            }

            for (int i = 0; i < 200; ++i)
            {
                stMsg msg = msgQueue.Get();
                if (msg != null)
                {
                    eventMgr.HandleCommond(msg.buffer);
                    msgQueue.Pop();
                }
            }
        }