Beispiel #1
0
        private static Dictionary <string, PackFile> ReuseMap(PackList old)
        {
            var forReuse = new Dictionary <string, PackFile>();

            foreach (PackFile p in old.packs)
            {
                if (p.IsInvalid)
                {
                    // The pack instance is corrupted, and cannot be safely used
                    // again. Do not include it in our reuse map.
                    //
                    p.Dispose();
                    continue;
                }

                PackFile prior = forReuse[p.File.Name] = p;
                if (prior != null)
                {
                    // This should never occur. It should be impossible for us
                    // to have two pack files with the same name, as all of them
                    // came out of the same directory. If it does, we promised to
                    // close any PackFiles we did not reuse, so close the one we
                    // just evicted out of the reuse map.
                    //
                    prior.Dispose();
                }
            }

            return(forReuse);
        }
Beispiel #2
0
        private void RemovePack(PackFile deadPack)
        {
            PackList o, n;

            do
            {
                o = _packList.get();
                PackFile[] oldList = o.packs;
                int        j       = indexOf(oldList, deadPack);
                if (j < 0)
                {
                    break;
                }
                var newList = new PackFile[oldList.Length - 1];
                Array.Copy(oldList, 0, newList, 0, j);
                Array.Copy(oldList, j + 1, newList, j, newList.Length - j);
                n = new PackList(o.lastRead, o.lastModified, newList);
            } while (!_packList.compareAndSet(o, n));
            deadPack.Dispose();
        }
Beispiel #3
0
 public void Dispose()
 {
     provider.Dispose();
     lruNext.Dispose();
     lruPrev.Dispose();
 }
 public void Dispose()
 {
     _packFile.Dispose();
 }
 public virtual void Dispose()
 {
     _pack.Dispose();
 }