Beispiel #1
0
        public bool Registrate(IPoolable poolItem)
        {
            lock (_poolStack)
            {
                if (TryPush(poolItem))
                {
                    _poolStack.TryPop(out var registrated);
                    if (poolItem.Equals(registrated) == false)
                    {
                        throw new InvalidOperationException("Registrate lazy pool item error");
                    }

                    return(true);
                }
            }

            return(false);
        }