Ejemplo n.º 1
0
        protected DLink BaseAddToPosition(DLink pNode)
        {
            if (this.poReserve == null)
            {
                this.PrivFillReservedPool(this.mDeltaGrow);
            }

            DLink pLink = DLink.PullFromFront(ref this.poReserve);

            Debug.Assert(pLink != null);

            // Wash it
            this.DerivedWash(pLink);

            // Update stats
            this.mNumActive++;
            this.mNumReserved--;

            // copy to active
            if (pNode == null)
            {
                DLink.AddToFront(ref this.poActive, pLink);
            }
            else
            {
                DLink.AddToBehind(ref pNode, pLink);
            }

            // YES - here's your new one (its recycled from reserved)
            return(pLink);
        }