public void Add(T item) { _list[_count] = new RefCount { Value = item, Count = _readerCount }; _count++; }
/// <summary> /// Decrement the reference count of the given <see cref="DocValuesProducer"/> /// generations. /// </summary> internal void DecRef(IList <long?> dvProducersGens) { UninterruptableMonitor.Enter(this); try { Exception t = null; foreach (long?gen in dvProducersGens) { RefCount <DocValuesProducer> dvp = genDVProducers[gen]; if (Debugging.AssertsEnabled) { Debugging.Assert(dvp != null, "gen={0}", gen); } try { dvp.DecRef(); } catch (Exception th) when(th.IsThrowable()) { if (t != null) { t = th; } } } if (t != null) { IOUtils.ReThrow(t); } } finally { UninterruptableMonitor.Exit(this); } }
/// <summary> /// Decrement the reference count of the given <see cref="DocValuesProducer"/> /// generations. /// </summary> internal void DecRef(IList <long?> dvProducersGens) { lock (this) { Exception t = null; foreach (long?gen in dvProducersGens) { RefCount <DocValuesProducer> dvp = genDVProducers[gen]; if (Debugging.AssertsEnabled) { Debugging.Assert(dvp != null, () => "gen=" + gen); } try { dvp.DecRef(); } catch (Exception th) { if (t != null) { t = th; } } } if (t != null) { IOUtils.ReThrow(t); } } }
/// <summary> /// Extension method for IDisposable. Decrements the refCount for the given disposable. /// </summary> /// /// <remarks> /// This method is thread-safe. /// </remarks> /// /// <param name="disposable"> The disposable to release. </param> /// /// <returns> /// True if disposable was disposed, false if not. /// </returns> public static bool Release(this IDisposable disposable) { lock (refCounts) { RefCount refCount = refCounts.GetOrCreateValue(disposable); if (refCount.refCount > 0) { refCount.refCount--; if (refCount.refCount == 0) { refCounts.Remove(disposable); disposable.Dispose(); return(true); } } else { // Retain() was never called, so assume there is only // one reference, which is now calling Release() disposable.Dispose(); return(true); } } return(false); }
private void Initialize(Stream baseStream, long offset, long length) { if (baseStream.CanSeek == false) { throw new ArgumentException("can’t seek on baseStream"); } if (offset < 0) { throw new ArgumentOutOfRangeException("offset"); } if (length < 0) { throw new ArgumentOutOfRangeException("length"); } SharedStream subStream = baseStream as SharedStream; if (subStream != null) { _baseStream = subStream.BaseStream; _offset = offset + subStream._offset; _length = length; _refCount = subStream._refCount; _refCount.Value++; } else { _baseStream = baseStream; _offset = offset; _length = length; _refCount = new RefCount(); _refCount.Value++; } }
public void Should_release_target_func_after_force() { var n = new RefCount().Value(); var lazy = Lambdas.Lazy<int>(new RefCount().Value); lazy(); GC.Collect(); GC.WaitForPendingFinalizers(); Check.That(() => RefCount.LiveObjects == 0); }
/// <summary> /// Extension method for IDisposable. /// Increments the Count for the given IDisposable object. /// Note: newly instantiated objects don't automatically have a Count of 1! /// If you wish to use ref-counting, always call retain() whenever you want /// to take ownership of an object. /// </summary> /// <remarks>This method is thread-safe.</remarks> /// <param name="disposable">The disposable that should be retained.</param> public static void Retain(this IDisposable disposable) { lock (mRefCounts) { RefCount refCount = mRefCounts.GetOrCreateValue(disposable); refCount.Count++; } }
public void Add(T item) { _list[Count] = new RefCount { Value = item, Count = ReaderCount }; Count++; }
/// <summary> /// Extension method for IDisposable. /// Increments the refCount for the given IDisposable object. /// Note: newly instantiated objects don't automatically have a refCount of 1! /// If you wish to use ref-counting, always call retain() whenever you want /// to take ownership of an object. /// </summary> /// <remarks> /// This method is thread-safe. /// </remarks> /// <param name="disposable"> /// The disposable that should be retained. /// </param> /// <returns> /// The <see cref="T"/>. /// </returns> public static T Retain <T>(this T disposable) where T : IDisposable { lock (refCounts) { RefCount refCount = refCounts.GetOrCreateValue(disposable); refCount.refCount++; } return(disposable); }
internal void IncRef(string fileName) { RefCount rc = GetRefCount(fileName); if (infoStream != null && VERBOSE_REF_COUNTS) { Message(" IncRef \"" + fileName + "\": pre-incr count is " + rc.count); } rc.IncRef(); }
private RefCount GetRefCount(string fileName) { Debug.Assert(IsLocked); // LUCENENET: Using TryGetValue to eliminate extra lookup if (!refCounts.TryGetValue(fileName, out RefCount rc)) { rc = new RefCount(fileName); refCounts[fileName] = rc; } return(rc); }
internal void IncRef(string fileName) { Debug.Assert(IsLocked); RefCount rc = GetRefCount(fileName); if (infoStream.IsEnabled("IFD")) { if (VERBOSE_REF_COUNTS) { infoStream.Message("IFD", " IncRef \"" + fileName + "\": pre-incr count is " + rc.count); } } rc.IncRef(); }
private RefCount GetRefCount(string fileName) { RefCount rc; if (!refCounts.ContainsKey(fileName)) { rc = new RefCount(); refCounts[fileName] = rc; } else { rc = refCounts[fileName]; } return(rc); }
internal void IncRef(System.Collections.IList files) { int size = files.Count; for (int i = 0; i < size; i++) { System.String fileName = (System.String)files[i]; RefCount rc = GetRefCount(fileName); if (infoStream != null && VERBOSE_REF_COUNTS) { Message(" IncRef \"" + fileName + "\": pre-incr count is " + rc.count); } rc.IncRef(); } }
private RefCount GetRefCount(System.String fileName) { RefCount rc; if (!refCounts.Contains(fileName)) { rc = new RefCount(); refCounts[fileName] = rc; } else { rc = (RefCount)refCounts[fileName]; } return(rc); }
private void DecRef(System.String fileName) { RefCount rc = GetRefCount(fileName); if (infoStream != null && VERBOSE_REF_COUNTS) { Message(" DecRef \"" + fileName + "\": pre-decr count is " + rc.count); } if (0 == rc.DecRef()) { // This file is no longer referenced by any past // commit points nor by the in-memory SegmentInfos: DeleteFile(fileName); refCounts.Remove(fileName); } }
private RefCount GetRefCount(string fileName) { Debug.Assert(IsLocked); RefCount rc; if (!refCounts.ContainsKey(fileName)) { rc = new RefCount(fileName); refCounts[fileName] = rc; } else { rc = refCounts[fileName]; } return(rc); }
public int Increment(object obj) { var wr = new WeakReference(obj); lock (_syncRoot) { RefCount refCount; if (!_counts.TryGetValue(wr, out refCount)) { refCount = new RefCount(); _counts[wr] = refCount; } refCount.Count++; return(refCount.Count); } }
public int Increment(object obj) { var wr = new WeakReference(obj); lock (_syncRoot) { RefCount refCount; if (!_counts.TryGetValue(wr, out refCount)) { refCount = new RefCount(); _counts[wr] = refCount; } refCount.Count++; return refCount.Count; } }
protected override void Dispose(bool disposing) { if (disposing) { if (_baseStream != null) { _refCount.Value--; if (_refCount.Value < 1) { _baseStream.Close(); } _refCount = null; _baseStream = null; } } base.Dispose(disposing); }
public override void Decode(byte[] byteArray, ref int p) { var start = p; Nonce = new U32(); Nonce.Decode(byteArray, ref p); Consumers = new RefCount(); Consumers.Decode(byteArray, ref p); Providers = new RefCount(); Providers.Decode(byteArray, ref p); AccountData = new AccountData(); AccountData.Decode(byteArray, ref p); _size = p - start; }
internal void DecRef(string fileName) { Debug.Assert(IsLocked); RefCount rc = GetRefCount(fileName); if (infoStream.IsEnabled("IFD")) { if (VERBOSE_REF_COUNTS) { infoStream.Message("IFD", " DecRef \"" + fileName + "\": pre-decr count is " + rc.count); } } if (0 == rc.DecRef()) { // this file is no longer referenced by any past // commit points nor by the in-memory SegmentInfos: DeleteFile(fileName); refCounts.Remove(fileName); } }
private void Initialize(Stream baseStream, long offset, long length) { if (baseStream.CanSeek == false) { throw new ArgumentException("can’t seek on baseStream"); } if (offset < 0) { throw new ArgumentOutOfRangeException("offset"); } if (length < 0) { throw new ArgumentOutOfRangeException("length"); } SharedStream subStream = baseStream as SharedStream; if (subStream != null) { _baseStream = subStream.BaseStream; _offset = offset + subStream._offset; _length = length; _refCount = subStream._refCount; _refCount.Value++; } else { _baseStream = baseStream; _offset = offset; _length = length; _refCount = new RefCount(); _refCount.Value++; } }
public SharedDisposable (SharedDisposable other) { obj = other.obj; refCount = other.refCount; ++refCount.count; }
public void copyFrom(RefCount rhv) { m_refNum = rhv.refNum; }
/// <summary> /// Initialize the deleter: find all previous commits in /// the <see cref="Directory"/>, incref the files they reference, call /// the policy to let it delete commits. this will remove /// any files not referenced by any of the commits. </summary> /// <exception cref="IOException"> if there is a low-level IO error </exception> public IndexFileDeleter(Directory directory, IndexDeletionPolicy policy, SegmentInfos segmentInfos, InfoStream infoStream, IndexWriter writer, bool initialIndexExists) { this.infoStream = infoStream; this.writer = writer; string currentSegmentsFile = segmentInfos.GetSegmentsFileName(); if (infoStream.IsEnabled("IFD")) { infoStream.Message("IFD", "init: current segments file is \"" + currentSegmentsFile + "\"; deletionPolicy=" + policy); } this.policy = policy; this.directory = directory; // First pass: walk the files and initialize our ref // counts: long currentGen = segmentInfos.Generation; CommitPoint currentCommitPoint = null; string[] files = null; try { files = directory.ListAll(); } #pragma warning disable 168 catch (DirectoryNotFoundException e) #pragma warning restore 168 { // it means the directory is empty, so ignore it. files = new string[0]; } if (currentSegmentsFile != null) { Regex r = IndexFileNames.CODEC_FILE_PATTERN; foreach (string fileName in files) { if (!fileName.EndsWith("write.lock", StringComparison.Ordinal) && !fileName.Equals(IndexFileNames.SEGMENTS_GEN, StringComparison.Ordinal) && (r.IsMatch(fileName) || fileName.StartsWith(IndexFileNames.SEGMENTS, StringComparison.Ordinal))) { // Add this file to refCounts with initial count 0: GetRefCount(fileName); if (fileName.StartsWith(IndexFileNames.SEGMENTS, StringComparison.Ordinal)) { // this is a commit (segments or segments_N), and // it's valid (<= the max gen). Load it, then // incref all files it refers to: if (infoStream.IsEnabled("IFD")) { infoStream.Message("IFD", "init: load commit \"" + fileName + "\""); } SegmentInfos sis = new SegmentInfos(); try { sis.Read(directory, fileName); } #pragma warning disable 168 catch (FileNotFoundException e) #pragma warning restore 168 { // LUCENE-948: on NFS (and maybe others), if // you have writers switching back and forth // between machines, it's very likely that the // dir listing will be stale and will claim a // file segments_X exists when in fact it // doesn't. So, we catch this and handle it // as if the file does not exist if (infoStream.IsEnabled("IFD")) { infoStream.Message("IFD", "init: hit FileNotFoundException when loading commit \"" + fileName + "\"; skipping this commit point"); } sis = null; } // LUCENENET specific - .NET (thankfully) only has one FileNotFoundException, so we don't need this //catch (NoSuchFileException) //{ // // LUCENE-948: on NFS (and maybe others), if // // you have writers switching back and forth // // between machines, it's very likely that the // // dir listing will be stale and will claim a // // file segments_X exists when in fact it // // doesn't. So, we catch this and handle it // // as if the file does not exist // if (infoStream.IsEnabled("IFD")) // { // infoStream.Message("IFD", "init: hit FileNotFoundException when loading commit \"" + fileName + "\"; skipping this commit point"); // } // sis = null; //} // LUCENENET specific - since NoSuchDirectoryException subclasses FileNotFoundException // in Lucene, we need to catch it here to be on the safe side. catch (System.IO.DirectoryNotFoundException) { // LUCENE-948: on NFS (and maybe others), if // you have writers switching back and forth // between machines, it's very likely that the // dir listing will be stale and will claim a // file segments_X exists when in fact it // doesn't. So, we catch this and handle it // as if the file does not exist if (infoStream.IsEnabled("IFD")) { infoStream.Message("IFD", "init: hit FileNotFoundException when loading commit \"" + fileName + "\"; skipping this commit point"); } sis = null; } catch (IOException /*e*/) { if (SegmentInfos.GenerationFromSegmentsFileName(fileName) <= currentGen && directory.FileLength(fileName) > 0) { throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details) } else { // Most likely we are opening an index that // has an aborted "future" commit, so suppress // exc in this case sis = null; } } if (sis != null) { CommitPoint commitPoint = new CommitPoint(commitsToDelete, directory, sis); if (sis.Generation == segmentInfos.Generation) { currentCommitPoint = commitPoint; } commits.Add(commitPoint); IncRef(sis, true); if (lastSegmentInfos == null || sis.Generation > lastSegmentInfos.Generation) { lastSegmentInfos = sis; } } } } } } if (currentCommitPoint == null && currentSegmentsFile != null && initialIndexExists) { // We did not in fact see the segments_N file // corresponding to the segmentInfos that was passed // in. Yet, it must exist, because our caller holds // the write lock. this can happen when the directory // listing was stale (eg when index accessed via NFS // client with stale directory listing cache). So we // try now to explicitly open this commit point: SegmentInfos sis = new SegmentInfos(); try { sis.Read(directory, currentSegmentsFile); } catch (IOException e) { throw new CorruptIndexException("failed to locate current segments_N file \"" + currentSegmentsFile + "\"" + e.ToString(), e); } if (infoStream.IsEnabled("IFD")) { infoStream.Message("IFD", "forced open of current segments file " + segmentInfos.GetSegmentsFileName()); } currentCommitPoint = new CommitPoint(commitsToDelete, directory, sis); commits.Add(currentCommitPoint); IncRef(sis, true); } // We keep commits list in sorted order (oldest to newest): CollectionUtil.TimSort(commits); // Now delete anything with ref count at 0. These are // presumably abandoned files eg due to crash of // IndexWriter. foreach (KeyValuePair <string, RefCount> entry in refCounts) { RefCount rc = entry.Value; string fileName = entry.Key; if (0 == rc.count) { if (infoStream.IsEnabled("IFD")) { infoStream.Message("IFD", "init: removing unreferenced file \"" + fileName + "\""); } DeleteFile(fileName); } } // Finally, give policy a chance to remove things on // startup: this.policy.OnInit(commits); // Always protect the incoming segmentInfos since // sometime it may not be the most recent commit Checkpoint(segmentInfos, false); startingCommitDeleted = currentCommitPoint == null ? false : currentCommitPoint.IsDeleted; DeleteCommits(); }
private RefCount GetRefCount(System.String fileName) { RefCount rc; if (!refCounts.ContainsKey(fileName)) { rc = new RefCount(fileName); refCounts[fileName] = rc; } else { rc = (RefCount) refCounts[fileName]; } return rc; }
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(RefCount obj) { return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr); }
/// <summary> Initialize the deleter: find all previous commits in /// the Directory, incref the files they reference, call /// the policy to let it delete commits. This will remove /// any files not referenced by any of the commits. /// </summary> /// <throws> CorruptIndexException if the index is corrupt </throws> /// <throws> IOException if there is a low-level IO error </throws> public IndexFileDeleter(Directory directory, IndexDeletionPolicy policy, SegmentInfos segmentInfos, System.IO.StreamWriter infoStream, DocumentsWriter docWriter, HashSet <string> synced) { this.docWriter = docWriter; this.infoStream = infoStream; this.synced = synced; if (infoStream != null) { Message("init: current segments file is \"" + segmentInfos.GetCurrentSegmentFileName() + "\"; deletionPolicy=" + policy); } this.policy = policy; this.directory = directory; // First pass: walk the files and initialize our ref // counts: long currentGen = segmentInfos.Generation; IndexFileNameFilter filter = IndexFileNameFilter.Filter; System.String[] files = directory.ListAll(); CommitPoint currentCommitPoint = null; for (int i = 0; i < files.Length; i++) { System.String fileName = files[i]; if (filter.Accept(null, fileName) && !fileName.Equals(IndexFileNames.SEGMENTS_GEN)) { // Add this file to refCounts with initial count 0: GetRefCount(fileName); if (fileName.StartsWith(IndexFileNames.SEGMENTS)) { // This is a commit (segments or segments_N), and // it's valid (<= the max gen). Load it, then // incref all files it refers to: if (infoStream != null) { Message("init: load commit \"" + fileName + "\""); } SegmentInfos sis = new SegmentInfos(); try { sis.Read(directory, fileName); } catch (System.IO.FileNotFoundException) { // LUCENE-948: on NFS (and maybe others), if // you have writers switching back and forth // between machines, it's very likely that the // dir listing will be stale and will claim a // file segments_X exists when in fact it // doesn't. So, we catch this and handle it // as if the file does not exist if (infoStream != null) { Message("init: hit FileNotFoundException when loading commit \"" + fileName + "\"; skipping this commit point"); } sis = null; } catch (System.IO.IOException) { if (SegmentInfos.GenerationFromSegmentsFileName(fileName) <= currentGen) { throw; } else { // Most likely we are opening an index that // has an aborted "future" commit, so suppress // exc in this case sis = null; } } if (sis != null) { CommitPoint commitPoint = new CommitPoint(this, commitsToDelete, directory, sis); if (sis.Generation == segmentInfos.Generation) { currentCommitPoint = commitPoint; } commits.Add(commitPoint); IncRef(sis, true); if (lastSegmentInfos == null || sis.Generation > lastSegmentInfos.Generation) { lastSegmentInfos = sis; } } } } } if (currentCommitPoint == null) { // We did not in fact see the segments_N file // corresponding to the segmentInfos that was passed // in. Yet, it must exist, because our caller holds // the write lock. This can happen when the directory // listing was stale (eg when index accessed via NFS // client with stale directory listing cache). So we // try now to explicitly open this commit point: SegmentInfos sis = new SegmentInfos(); try { sis.Read(directory, segmentInfos.GetCurrentSegmentFileName()); } catch (System.IO.IOException) { throw new CorruptIndexException("failed to locate current segments_N file"); } if (infoStream != null) { Message("forced open of current segments file " + segmentInfos.GetCurrentSegmentFileName()); } currentCommitPoint = new CommitPoint(this, commitsToDelete, directory, sis); commits.Add(currentCommitPoint); IncRef(sis, true); } // We keep commits list in sorted order (oldest to newest): commits.Sort(); // Now delete anything with ref count at 0. These are // presumably abandoned files eg due to crash of // IndexWriter. foreach (KeyValuePair <string, RefCount> entry in refCounts) { string fileName = entry.Key; RefCount rc = refCounts[fileName]; if (0 == rc.count) { if (infoStream != null) { Message("init: removing unreferenced file \"" + fileName + "\""); } DeleteFile(fileName); } } // Finally, give policy a chance to remove things on // startup: policy.OnInit(commits); // Always protect the incoming segmentInfos since // sometime it may not be the most recent commit Checkpoint(segmentInfos, false); startingCommitDeleted = currentCommitPoint.IsDeleted; DeleteCommits(); }
protected override void Dispose(bool disposing) { if (disposing) { if (_baseStream != null) { _refCount.Value--; if (_refCount.Value < 1) { _baseStream.Close(); } _refCount = null; _baseStream = null; } } base.Dispose(disposing); }
/// <summary> Initialize the deleter: find all previous commits in /// the Directory, incref the files they reference, call /// the policy to let it delete commits. The incoming /// segmentInfos must have been loaded from a commit point /// and not yet modified. This will remove any files not /// referenced by any of the commits. /// </summary> /// <throws> CorruptIndexException if the index is corrupt </throws> /// <throws> IOException if there is a low-level IO error </throws> public IndexFileDeleter(Directory directory, IndexDeletionPolicy policy, SegmentInfos segmentInfos, System.IO.TextWriter infoStream, DocumentsWriter docWriter) { this.docWriter = docWriter; this.infoStream = infoStream; if (infoStream != null) { Message("init: current segments file is \"" + segmentInfos.GetCurrentSegmentFileName() + "\"; deletionPolicy=" + policy); } this.policy = policy; this.directory = directory; // First pass: walk the files and initialize our ref // counts: long currentGen = segmentInfos.GetGeneration(); IndexFileNameFilter filter = IndexFileNameFilter.GetFilter(); System.String[] files = directory.List(); if (files == null) { throw new System.IO.IOException("cannot read directory " + directory + ": list() returned null"); } CommitPoint currentCommitPoint = null; for (int i = 0; i < files.Length; i++) { System.String fileName = files[i]; if (filter.Accept(null, fileName) && !fileName.Equals(IndexFileNames.SEGMENTS_GEN)) { // Add this file to refCounts with initial count 0: GetRefCount(fileName); if (fileName.StartsWith(IndexFileNames.SEGMENTS)) { // This is a commit (segments or segments_N), and // it's valid (<= the max gen). Load it, then // incref all files it refers to: if (SegmentInfos.GenerationFromSegmentsFileName(fileName) <= currentGen) { if (infoStream != null) { Message("init: load commit \"" + fileName + "\""); } SegmentInfos sis = new SegmentInfos(); try { sis.Read(directory, fileName); } catch (System.IO.FileNotFoundException e) { // LUCENE-948: on NFS (and maybe others), if // you have writers switching back and forth // between machines, it's very likely that the // dir listing will be stale and will claim a // file segments_X exists when in fact it // doesn't. So, we catch this and handle it // as if the file does not exist if (infoStream != null) { Message("init: hit FileNotFoundException when loading commit \"" + fileName + "\"; skipping this commit point"); } sis = null; } if (sis != null) { CommitPoint commitPoint = new CommitPoint(this, sis); if (sis.GetGeneration() == segmentInfos.GetGeneration()) { currentCommitPoint = commitPoint; } commits.Add(commitPoint); IncRef(sis, true); } } } } } if (currentCommitPoint == null) { // We did not in fact see the segments_N file // corresponding to the segmentInfos that was passed // in. Yet, it must exist, because our caller holds // the write lock. This can happen when the directory // listing was stale (eg when index accessed via NFS // client with stale directory listing cache). So we // try now to explicitly open this commit point: SegmentInfos sis = new SegmentInfos(); try { sis.Read(directory, segmentInfos.GetCurrentSegmentFileName()); } catch (System.IO.IOException e) { throw new CorruptIndexException("failed to locate current segments_N file"); } if (infoStream != null) { Message("forced open of current segments file " + segmentInfos.GetCurrentSegmentFileName()); } currentCommitPoint = new CommitPoint(this, sis); commits.Add(currentCommitPoint); IncRef(sis, true); } // We keep commits list in sorted order (oldest to newest): commits.Sort(); // Now delete anything with ref count at 0. These are // presumably abandoned files eg due to crash of // IndexWriter. System.Collections.IEnumerator it = refCounts.Keys.GetEnumerator(); while (it.MoveNext()) { System.String fileName = (System.String)it.Current; RefCount rc = (RefCount)refCounts[fileName]; if (0 == rc.count) { if (infoStream != null) { Message("init: removing unreferenced file \"" + fileName + "\""); } DeleteFile(fileName); } } // Finally, give policy a chance to remove things on // startup: policy.OnInit(commits); // It's OK for the onInit to remove the current commit // point; we just have to checkpoint our in-memory // SegmentInfos to protect those files that it uses: if (currentCommitPoint.deleted) { Checkpoint(segmentInfos, false); } DeleteCommits(); }
public MultiAssetInfo(string assetName, AssetSuccessDelegate onSuccess, AssetFailureDelegate onFailure, object cookie, RefCount refCount, AssetsCompleteDelegate onComplete, object completeCookie) : base(AssetHandle.Invalid, assetName, onSuccess, onFailure, cookie) { this.RefCount = refCount; this.OnComplete = onComplete; this.CompleteCookie = completeCookie; }
private RefCount GetRefCount(string fileName) { RefCount rc; if (!refCounts.ContainsKey(fileName)) { rc = new RefCount(); refCounts[fileName] = rc; } else { rc = refCounts[fileName]; } return rc; }
protected RefCount m_refCount; // 引用计数 public RefCountResLoadResultNotify() { m_refCount = new RefCount(); }
public SharedDisposable (IDisposable disposable) { obj = disposable; refCount = new RefCount(); ++refCount.count; }
public override void Dispose() { RefCount.Decrement(); }
private RefCount GetRefCount(string fileName) { Debug.Assert(Locked()); RefCount rc; if (!RefCounts.ContainsKey(fileName)) { rc = new RefCount(fileName); RefCounts[fileName] = rc; } else { rc = RefCounts[fileName]; } return rc; }
public void Add(T item) { _list[Count] = new RefCount(item, ReaderCount); Count++; }
protected RefCount m_refCount; // 引用计数 public RefCountResLoadResultNotify() { m_refCount = new RefCount(); }
public void copyFrom(RefCount rhv) { m_refNum = rhv.refNum; }