private void ReturnToPool(LibGit2Repo repo) { if (repo != null) { if (this.pool.IsAddingCompleted || !this.pool.TryAdd(repo, TryAddTimeoutMilliseconds)) { // No more adding to the pool or trying to add to the pool failed repo.Dispose(); } } }
private void ReturnToPool(LibGit2Repo repo) { if (repo != null) { this.ResetRepoDisposalTimer(); if (this.pool.IsAddingCompleted || !this.pool.TryAdd(repo, TryAddTimeoutMilliseconds)) { // No more adding to the pool or the pool is full Interlocked.Decrement(ref this.numActiveRepos); repo.Dispose(); } } }