internal LockToken AssertNotCanceled() { if (LockState.IsCanceled(_token)) { ThrowCanceled(); } return(this); void ThrowCanceled() => throw new TaskCanceledException(); }
private void OnAssignedImpl() // make sure this happens on the { // scheduler's thread to avoid the release thread being stolen var token = LockState.GetResult(ref _token); if (LockState.IsCanceled(token)) { TrySetCanceled(); } else { TrySetResult(new LockToken(_mutex, token)); } }
bool IAsyncPendingLockToken.IsCanceled(short key) => LockState.IsCanceled(Volatile.Read(ref _tokens[key]));
bool IAsyncPendingLockToken.IsCanceled(short key) => LockState.IsCanceled(_token);