Exemplo n.º 1
0
 internal ProtoOwner(byte[] array, int offset, ProtoLRUCache parent, BlockIdentifier bid)
 {
     _array  = array;
     _offset = offset;
     _parent = parent;
     _bid    = bid;
 }
Exemplo n.º 2
0
        public ProtoBlockCache(int maxBlocks)
        {
            _lruCache = new ProtoLRUCache(maxBlocks, _cache);

            _completionPort = CreateIoCompletionPort((IntPtr)(-1), IntPtr.Zero, UIntPtr.Zero, (uint)_threads.Length);
            if (_completionPort.IsInvalid)
            {
                var error = Marshal.GetLastWin32Error();
                throw new 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;
            }
        }