Esempio n. 1
0
        //回收对象节点
        public void Recycle(ref QueueNode <ByteData> node)
        {
            int nBoundSize = node.item.data.Length;
            ThreadQueue <ByteData> queueData = null;

            if (m_dicMemPool.TryGetValue(nBoundSize, out queueData))
            {
                if (queueData.Size() < m_nQueueMaxSize)
                {
                    queueData.Push(node);
                }
            }
        }
Esempio n. 2
0
        private void RecycleSegmentNode(QueueNode <Segment> node)
        {
            //回收data的内存
            m_oMemPool.Recycle(ref node.item.data);
            node.item.data = null;
            node.next      = null;


            if (null != node)
            {
                if (IKCP_MAX_SEGMENT_OBJECT > m_oSegmentPool.Size())
                {
                    m_oSegmentPool.Push(node);
                }
            }
        }
Esempio n. 3
0
 //压入节点(在生产者线程调用)
 public void Push(QueueNode <ByteData> node)
 {
     m_oDataQueue.Push(node);
 }
Esempio n. 4
0
 //回收节点(在消费者线程调用)
 public void Recycle(ref QueueNode <ByteData> node)
 {
     m_oRecycleQueue.Push(node);
 }