21 instantiations of State
System.Private.CoreLib (21)
src\libraries\System.Private.CoreLib\src\System\Threading\Lock.cs (21)
302Debug.Assert(new State(this).IsLocked); 365Debug.Assert(new State(this).IsLocked); 544if (!waitEvent.WaitOneNoCheck(remainingTimeoutMs, new State(this).UseTrivialWaits)) 691Debug.Assert(!isHeld || new State(this).IsLocked); 732Debug.Assert(!isHeld || new State(this).IsLocked); 870Debug.Assert(!new State(this).UseTrivialWaits); 876Debug.Assert(!new State(this).UseTrivialWaits); 972if (new State(newState).HasAnySpinners) // overflow check 1023if (new State(newState).HasAnyWaiters) // overflow check 1054new State(Interlocked.CompareExchange(ref lockObj._state, toState._state, fromState._state)); 1075var state = new State(lockObj); 1092var state = new State(Interlocked.Decrement(ref lockObj._state)); 1132var state = new State(lockObj); 1182var state = new State(lockObj); 1212var state = new State(Interlocked.Add(ref lockObj._state, Neg(SpinnerCountIncrement))); 1213Debug.Assert(new State(state._state + SpinnerCountIncrement).HasAnySpinners); 1242var state = new State(lockObj); 1298var state = new State(lockObj); 1356var state = new State(Interlocked.Add(ref lockObj._state, Neg(IsWaiterSignaledToWakeMask))); 1357Debug.Assert(new State(state._state + IsWaiterSignaledToWakeMask).IsWaiterSignaledToWake); 1413var state = new State(lockObj);
60 references to State
System.Private.CoreLib (60)
src\libraries\System.Private.CoreLib\src\System\Threading\Lock.cs (60)
69State.InitializeUseTrivialWaits(this, useTrivialWaits); 250if (currentThreadId != UninitializedThreadId && State.TryLock(this)) 308State state = State.Unlock(this); 328State state = State.Unlock(this); 358if (State.TryLock(this)) 417TryLockResult tryLockResult = State.TryLockBeforeSpinLoop(this, spinCount, out bool isFirstSpinner); 444tryLockResult = State.TryLockInsideSpinLoop(this); 472tryLockResult = State.TryLockAfterSpinLoop(this); 516if (State.TryLockBeforeWait(this)) 560if (State.TryLockInsideWaiterSpinLoop(this)) 574if (State.TryLockAfterWaiterSpinLoop(this)) 615State.UnregisterWaiter(this); 619State.UnregisterWaiter(this); 671private void SignalWaiterIfNecessary(State state) 673if (State.TrySetIsWaiterSignaledToWake(this, state)) 715if (State.TryLock(this)) 774if (State.TryLock(this)) 872_state = managedThreadId == 0 ? State.InitialStateValue : State.LockedStateValue; 914private struct State : IEquatable<State> 1046public static bool operator ==(State state1, State state2) => state1._state == state2._state; 1047public static bool operator !=(State state1, State state2) => !(state1 == state2); 1049bool IEquatable<State>.Equals(State other) => this == other; 1050public override bool Equals(object? obj) => obj is State other && this == other; 1053private static State CompareExchange(Lock lockObj, State toState, State fromState) => 1075var state = new State(lockObj); 1081State newState = state; 1088public static State Unlock(Lock lockObj) 1092var state = new State(Interlocked.Decrement(ref lockObj._state)); 1132var state = new State(lockObj); 1135State newState = state; 1163State stateBeforeUpdate = CompareExchange(lockObj, newState, state); 1182var state = new State(lockObj); 1191State newState = state; 1195State stateBeforeUpdate = CompareExchange(lockObj, newState, state); 1212var state = new State(Interlocked.Add(ref lockObj._state, Neg(SpinnerCountIncrement))); 1223State newState = state; 1226State stateBeforeUpdate = CompareExchange(lockObj, newState, state); 1242var state = new State(lockObj); 1246State newState = state; 1269State stateBeforeUpdate = CompareExchange(lockObj, newState, state); 1298var state = new State(lockObj); 1309State newState = state; 1328State stateBeforeUpdate = CompareExchange(lockObj, newState, state); 1356var state = new State(Interlocked.Add(ref lockObj._state, Neg(IsWaiterSignaledToWakeMask))); 1369State newState = state; 1387State stateBeforeUpdate = CompareExchange(lockObj, newState, state); 1413var state = new State(lockObj); 1418State newState = state; 1425State stateBeforeUpdate = CompareExchange(lockObj, newState, state); 1436public static bool TrySetIsWaiterSignaledToWake(Lock lockObj, State state) 1455State newState = state; 1462State stateBeforeUpdate = CompareExchange(lockObj, newState, state);