예제 #1
0
        protected MLink baseAddToFront()
        {
            // Are there any nodes on the Reserve list?
            if (this.pReserve == null)
            {
                // refill the reserve list by the refill size
                this.privFillReservedPool(this.mRefillSize);
            }

            // Always take from the reserve list
            MLink pNode = MLink.PullFromFront(ref this.pReserve);

            Debug.Assert(pNode != null);

            // Update stats
            this.mNumActive++;
            //update active high count if needed;
            if (this.mNumActive > this.mActiveHighCount)
            {
                this.mActiveHighCount = this.mNumActive;
            }
            this.mNumReserve--;

            // copy to active
            MLink.AddToFront(ref this.pActive, pNode);

            //Debug.WriteLine("Base Add Node called");

            // YES - here's your new one (may its reused from reserved)
            return(pNode);
        }
예제 #2
0
        protected MLink basePopReserve()
        {
            // Are there any nodes on the Reserve list?
            if (this.pReserve == null)
            {
                // refill the reserve list by the DeltaGrow
                this.privFillReservedPool(this.mRefillSize);
            }

            // Always take from the reserve list
            MLink pNode = MLink.PullFromFront(ref this.pReserve);

            Debug.Assert(pNode != null);

            // Update stats
            this.mNumReserve--;

            // YES - here's your new one (may its reused from reserved)
            return(pNode);
        }