public void BasicTest() { var l = new AsyncReaderWriterLockSlim(); var vt1 = l.AcquireReaderLockAsync(); var vt2 = l.AcquireReaderLockAsync(); var vt3 = l.AcquireWriterLockAsync(); Assert.True(vt1.IsCompletedSuccessfully); Assert.True(vt2.IsCompletedSuccessfully); Assert.False(vt3.IsCompleted); vt1.GetAwaiter().GetResult(); vt2.GetAwaiter().GetResult(); l.ReleaseReaderLock(); l.ReleaseReaderLock(); Assert.True(vt3.IsCompletedSuccessfully); vt1 = l.AcquireReaderLockAsync(); vt2 = l.AcquireReaderLockAsync(); Assert.False(vt1.IsCompleted); Assert.False(vt2.IsCompleted); vt3.GetAwaiter().GetResult(); l.ReleaseWriterLock(); Assert.True(vt1.IsCompletedSuccessfully); Assert.True(vt2.IsCompletedSuccessfully); }