Esempio n. 1
0
        internal SynchronizedStateChange(ManualResetEvent prevStateNotChangingEvent, ManualResetEvent currentStateNotChangingEvent, SynchronizedState <TState> stateObj, object userState, Action <object, TState> setResultState)
        {
            if (prevStateNotChangingEvent == null)
            {
                throw new ArgumentNullException("prevStateNotChangingEvent");
            }

            if (currentStateNotChangingEvent == null)
            {
                throw new ArgumentNullException("currentStateNotChangingEvent");
            }

            if (setResultState == null)
            {
                throw new ArgumentNullException("setResultState");
            }

            _stateNotChangingEvent = currentStateNotChangingEvent;
            _setResultState        = setResultState;
            _stateObj = stateObj;
            prevStateNotChangingEvent.WaitOne();
            prevStateNotChangingEvent.Dispose();
            NewState  = stateObj.CurrentState;
            UserState = userState;
        }
Esempio n. 2
0
        public override bool Equals(object obj)
        {
            SynchronizedState <TState> s = obj as SynchronizedState <TState>;

            if (s == null)
            {
                return(false);
            }

            if (ReferenceEquals(s, this))
            {
                return(true);
            }

            lock (_syncRoot)
            {
                lock (s._syncRoot)
                    return(_comparer.Equals(CurrentState, s._currentState));
            }
        }
Esempio n. 3
0
 internal SynchronizedStateChange(ManualResetEvent prevStateNotChangingEvent, ManualResetEvent currentStateNotChangingEvent, SynchronizedState <TState> stateObj, Action <object, TState> setResultState)
     : this(prevStateNotChangingEvent, currentStateNotChangingEvent, stateObj, null, setResultState)
 {
 }
Esempio n. 4
0
 public SupercessiveTaskState(TSource source, TResult initialValue) : base(new SupercedableTaskState <TSource, TResult>(source, initialValue))
 {
     _currentResult = initialValue;
     _currentTaskId = new Common.SynchronizedState <int>(CurrentState.TaskId);
 }