private AsyncReaderWriterLock CreateLeasedLock(TKey key) { if (!this.pool.TryTake(out AsyncReaderWriterLock? asyncLock)) { asyncLock = new AsyncReaderWriterLock(); } asyncLock.OnRelease = () => this.activeLocks.Release(key); return(asyncLock); }
internal Releaser(AsyncReaderWriterLock toRelease, bool writer) { this.toRelease = toRelease; this.writer = writer; }