private AsyncReaderWriterLock CreateLeasedLock(TKey key)
        {
            if (!this.pool.TryTake(out AsyncReaderWriterLock? asyncLock))
            {
                asyncLock = new AsyncReaderWriterLock();
            }

            asyncLock.OnRelease = () => this.activeLocks.Release(key);
            return(asyncLock);
        }
示例#2
0
 internal Releaser(AsyncReaderWriterLock toRelease, bool writer)
 {
     this.toRelease = toRelease;
     this.writer    = writer;
 }