Example #1
0
            internal AtPopEnumerator(LLStack <T> stack)
            {
                SinglyLinkedNode <T> node = stack._head.Next;

                for (;;)
                {
                    SinglyLinkedNode <T> oldNext = Interlocked.CompareExchange(ref stack._head.Next, null, node);
                    if (oldNext == node)
                    {
                        _node.Next = node;
                        return;
                    }
                    node = oldNext;
                }
            }
Example #2
0
 internal Enumerator(LLStack <T> stack)
 {
     _node = (_stack = stack)._head;
 }
Example #3
0
 internal PopEnumerator(LLStack <T> stack)
 {
     _stack = stack;
 }