public void AddRef() { Bid.Trace("<ds.Index.AddRef|API> %d#\n", ObjectID); LockCookie lc = table.indexesLock.UpgradeToWriterLock(-1); try { Debug.Assert(0 <= refCount, "AddRef on disposed index"); Debug.Assert(null != records, "null records"); if (refCount == 0) { table.ShadowIndexCopy(); table.indexes.Add(this); } refCount++; } finally { table.indexesLock.DowngradeFromWriterLock(ref lc); } }
public void AddRef() { DataCommonEventSource.Log.Trace("<ds.Index.AddRef|API> {0}", ObjectID); _table._indexesLock.EnterWriteLock(); try { Debug.Assert(0 <= _refCount, "AddRef on disposed index"); Debug.Assert(null != _records, "null records"); if (_refCount == 0) { _table.ShadowIndexCopy(); _table._indexes.Add(this); } _refCount++; } finally { _table._indexesLock.ExitWriteLock(); } }