public override bool RunOnLfdll(
     LfdllExecutionState state)
 {
     if (state.Current == null ||
         state.Current == state.List.Head ||
         state.Current == state.List.Tail)
     {
         return(false);
     }
     return(state.Current.Remove());
 }
        public override ILockFreeDoublyLinkedListNode <ListItemData> RunOnLfdll(
            LfdllExecutionState state)
        {
            ILockFreeDoublyLinkedListNode <ListItemData> current = state.Current;

            if (current == null || current == state.List.Tail)
            {
                return(null);
            }
            return(state.AddingToKnownNodes(current.InsertAfter(Value)));
        }
 public override object RunOnLfdll(LfdllExecutionState state)
 {
     if (state.Current != null &&
         state.Current != state.List.Head &&
         state.Current != state.List.Tail)
     {
         long nodeId = state.Current.Value.NodeId;
         state.Current.Value = new ListItemData(nodeId, value);
     }
     return(null);
 }
 public lfdllOperationExecutor(
     ExecutionSequenceParameters eParams,
     ILockFreeDoublyLinkedList <ListItemData> list, Counter counter,
     int name)
 {
     this.eParams = eParams;
     this.counter = counter;
     Name         = name;
     state        = new LfdllExecutionState(list);
     state.AddToKnownNodes(list.Head);
     state.AddingToKnownNodes(list.Tail);
 }
        public override ILockFreeDoublyLinkedListNode <ListItemData> RunOnLfdll(
            LfdllExecutionState state)
        {
            ILockFreeDoublyLinkedListNode <ListItemData> node
                = state.List.PopRightNode();

            if (node != null)
            {
                state.AddToKnownNodes(node);
            }
            return(node);
        }
Example #6
0
 public override ILockFreeDoublyLinkedListNode <ListItemData> RunOnLfdll(
     LfdllExecutionState state)
 {
     if (state.Current == null ||
         state.Current == state.List.Head ||
         state.Current == state.List.Tail)
     {
         return(null);
     }
     return
         (state.AddingToKnownNodes(
              state.Current.InsertAfterIf(
                  Value, data => data.Value == prevalentValue)));
 }
Example #7
0
        public override object RunOnLfdll(
            LfdllExecutionState state)
        {
            ILockFreeDoublyLinkedListNode <ListItemData> current = state.Current;

            if (current == null || current == state.List.Head)
            {
                current = state.List.Head;
            }
            else
            {
                current = current.Prev;
            }
            state.Current = current;
            return(null);
        }
Example #8
0
        public override ListItemData RunOnLfdll(LfdllExecutionState state)
        {
            if (state.Current == null || state.Current.IsDummyNode)
            {
                return(null);
            }
            ListItemData oldData = state.Current.Value;

            while (true)
            {
                if (oldData.Value != oldValue)
                {
                    return(oldData);
                }
                ListItemData prevalentData = state.Current.CompareExchangeValue(
                    oldData.NewWithValue(newValue), oldData);
                if (ReferenceEquals(prevalentData, oldData))
                {
                    return(prevalentData);
                }
                oldData = prevalentData;
            }
        }
 public override ListItemData RunOnLfdll(LfdllExecutionState state)
 {
     return(state.Current == null || state.Current.IsDummyNode ?
            null :
            state.Current.Value);
 }
 public override object RunOnLfdll(LfdllExecutionState state)
 {
     return(run(state));
 }
Example #11
0
 public override ILockFreeDoublyLinkedListNode <ListItemData> RunOnLfdll(
     LfdllExecutionState state)
 {
     return(state.AddingToKnownNodes(state.List.PushRight(Value)));
 }