Contains static helpers for use with buffer pools, avoiding unnecessary type parameters.
Ejemplo n.º 1
0
 /// <summary>
 /// Creates a new memory pool.
 /// </summary>
 /// <param name="memoryPoolSize">Size of the pool in elements.</param>
 /// <param name="idBufferPool">Buffer pool to use in the allocator. If null, the allocator picks.</param>
 /// <param name="allocationBufferPool">Buffer pool to use in the allocator. If null, the allocator picks.</param>
 /// <param name="tableBufferPool">Buffer pool to use in the allocator. If null, the allocator picks.</param>
 public Allocator(long memoryPoolSize,
     BufferPool<ulong> idBufferPool = null, BufferPool<Allocation> allocationBufferPool = null, BufferPool<int> tableBufferPool = null)
 {
     this.memoryPoolSize = memoryPoolSize;
     if (idBufferPool == null)
         idBufferPool = BufferPools<ulong>.Locking;
     if (allocationBufferPool == null)
         allocationBufferPool = BufferPools<Allocation>.Locking;
     if (tableBufferPool == null)
         tableBufferPool = BufferPools<int>.Locking;
     allocations = new QuickDictionary<ulong, Allocation>(idBufferPool, allocationBufferPool, tableBufferPool);
 }