예제 #1
0
 public void Reset()
 {
     if (CurrentNode != null)
     {
         CurrentNode.EnumeratorRelease();
     }
     CurrentNode = rootList.LinkNode;
     CurrentNode.EnumeratorHold();
     TimeoutClock.Reset();
     TimeoutClock.Start();
 }
예제 #2
0
        private bool TryMove(Predicate <T> Predicate = null, bool Remove = false)
        {
            lock (rootList.mutex)
            {
                var StartNode = CurrentNode;

                //CurrentNode.Next should never be null
                while (!CurrentNode.Next.Equals(rootList.LinkNode))
                {
                    CurrentNode = CurrentNode.Next;
                    if (Predicate?.Invoke(CurrentNode.Item) ?? true)
                    {
                        StartNode.EnumeratorRelease();
                        CurrentNode.EnumeratorHold();
                        if (Remove)
                        {
                            CurrentNode.Remove();
                        }
                        return(true);
                    }
                }
            }
            return(false);
        }