public AsyncBlockCache(int blockCount) { _allocator = new AsyncBlockAllocator(blockCount, FileConsts.PageSize); _completionPort = CreateIoCompletionPort((IntPtr)(-1), IntPtr.Zero, UIntPtr.Zero, (uint)_threads.Length); if (_completionPort.IsInvalid) { var error = Marshal.GetLastWin32Error(); throw new System.IO.FileLoadException($"Unable to create a completion port with code {error}"); } for (var i = 0; i < _threads.Length; i++) { var thread = new System.Threading.Thread(IOThreadLoop); thread.IsBackground = true; thread.Start(); _threads[i] = thread; } }
public AsyncBlockManagedMemory(AsyncBlockAllocator asyncBlockAllocator, int offset, int blockSize) { _blockSize = blockSize; _asyncBlockAllocator = asyncBlockAllocator; _offset = offset; }