예제 #1
0
 public void Return(SegmentWorkOutput obj)
 {
     _arrayPool.Return(obj.Output);
     obj.Output       = null;
     obj.YPos         = 0;
     obj.Stride       = 0;
     obj.OriginalSize = 0;
     _pool.Enqueue(obj);
 }
예제 #2
0
        public SegmentWorkOutput Request(int bufferSize, ushort yPos, ushort stride, ushort originalSize)
        {
            var res = _pool.TryDequeue(out var obj);

            if (!res)
            {
                obj = new SegmentWorkOutput();
            }

            obj.Output       = _arrayPool.Rent(bufferSize);
            obj.YPos         = yPos;
            obj.Stride       = stride;
            obj.OriginalSize = originalSize;

            return(obj);
        }