コード例 #1
0
 public static void DropPool()
 {
     while (_root != null)
     {
         var node = _root;
         _root      = node.Next;
         node.Value = null;
         node.Next  = null;
         PoolNode.Recycle(node);
     }
 }
コード例 #2
0
        /// <summary>
        /// Gets the pool's current capacity
        /// </summary>
        public static uint Count()
        {
            uint     count = 0;
            PoolNode it    = _root;

            while (it != null)
            {
                count++;
                it = it.Next;
            }
            return(count);
        }
コード例 #3
0
        public static PoolNode GetNewNode()
        {
            if (_root == null)
            {
                return(new PoolNode());
            }

            var n = _root;

            _root   = _root.Next;
            n.Next  = null;
            n.Value = null;
            return(n);
        }
コード例 #4
0
 public static void Recycle(PoolNode node)
 {
     node.Value = null;
     node.Next  = _root;
     _root      = node;
 }