public void HandlesCancellation() { var asyncLock = new AsyncLock(); var lockOne = asyncLock.LockAsync(); var cts = new CancellationTokenSource(); var lockTwo = asyncLock.LockAsync(cts.Token); Assert.True(lockOne.IsCompleted); Assert.Equal(TaskStatus.RanToCompletion, lockOne.Status); Assert.NotNull(lockOne.Result); Assert.False(lockTwo.IsCompleted); cts.Cancel(); Assert.True(lockTwo.IsCompleted); Assert.True(lockTwo.IsCanceled); lockOne.Result.Dispose(); }
internal Releaser(AsyncLock toRelease) { m_toRelease = toRelease; }
internal Releaser(AsyncLock toRelease) { _toRelease = toRelease; }