public void DecrementReferenceCount() { if (Interlocked.Decrement(ref _referenceCount) == 0) { _pool.ReleaseChunk(this); } }
// public methods /// <summary> /// Decrements the reference count. /// </summary> /// <exception cref="BsonInternalException">Reference count is less than or equal to zero.</exception> public void DecrementReferenceCount() { if (_referenceCount <= 0) { throw new BsonInternalException("Reference count is less than or equal to zero."); } if (--_referenceCount == 0 && _chunkPool != null) { _chunkPool.ReleaseChunk(this); } }