internal LockToken AssertNotCanceled()
            {
                if (LockState.IsCanceled(_token))
                {
                    ThrowCanceled();
                }
                return(this);

                void ThrowCanceled() => throw new TaskCanceledException();
            }
Exemple #2
0
            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));
                }
            }
Exemple #3
0
 bool IAsyncPendingLockToken.IsCanceled(short key) => LockState.IsCanceled(Volatile.Read(ref _tokens[key]));
Exemple #4
0
 bool IAsyncPendingLockToken.IsCanceled(short key) => LockState.IsCanceled(_token);