示例#1
0
文件: Pool.cs 项目: gonznak/Socket
        /// <summary>
        /// Puts the object's slot back to the pool.
        /// </summary>
        /// <param name="slot">The slot to return</param>
        /// <exception cref="ArgumentNullException" />
        /// <exception cref="ArgumentException" />
        /// <exception cref="InvalidOperationException" />
        public void Release(PoolSlot <T> slot)
        {
            if (slot == null)
            {
                throw new ArgumentNullException("slot");
            }
            if (slot.GetStatus(this))
            {
                throw new InvalidOperationException("Specified object is already in the pool");
            }

            CleanUp(slot.Object);
            Push(slot);
        }