コード例 #1
0
        private bool TryChangeState(AmbientScopeState newState, AmbientScopeState expectedCurrentState)
        {
            var previousState = Interlocked.CompareExchange(ref this._state, (int)newState, (int)expectedCurrentState);

            return(previousState == (int)expectedCurrentState);
        }
コード例 #2
0
 private void ChangeState(AmbientScopeState newState)
 {
     this._state = (int)newState;
 }
コード例 #3
0
 private void ChangeState(AmbientScopeState newState, out AmbientScopeState previousState)
 {
     previousState = (AmbientScopeState)Interlocked.Exchange(ref this._state, (int)newState);
 }